emptygif
Dil: Türkçe

Tüm diller ve framework'ler

veb (V web framework) V

veb (V web framework) için, /pixel.gif isteklerine başlangıçta bir kez çözülen boş GIF ile yanıt veren bir V örneği.

veb (V web framework) V

Dosya
server.v
Çalıştır
v run server.v
module main

import encoding.base64
import veb

const gif = base64.decode_str('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==')

pub struct Context {
    veb.Context
}

pub struct App {}

@['/pixel.gif'; get]
pub fn (app &App) pixel(mut ctx Context) veb.Result {
    ctx.set_header(.cache_control, 'no-store')
    return ctx.send_response_to_client('image/gif', gif)
}

fn main() {
    mut app := &App{}
    veb.run[App, Context](mut app, 8080)
}

Framework'ün güncel belgelerine göre kontrol edildi.

Kontrol et

curl -sI http://localhost:8080/pixel.gif

Resmî site: veb (V web framework)