veb (V web framework) V
Snippet na V don veb (V web framework) da ke amsa requests zuwa /pixel.gif da empty GIF, wanda ake decoding ɗinsa sau ɗaya lokacin farawa.
veb (V web framework) 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)
}
An duba shi da takardun bayani na yanzu na framework ɗin.
Duba shi
curl -sI http://localhost:8080/pixel.gif