veb (V web framework) V
veb (V web framework) માટે V સ્નિપેટ, જે /pixel.gif પરની રિક્વેસ્ટનો જવાબ empty GIF થી આપે છે. GIF સ્ટાર્ટઅપ વખતે એક જ વાર ડિકોડ થાય છે.
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)
}
ફ્રેમવર્કના હાલના ડૉક્યુમેન્ટેશન સાથે મેળવીને ચકાસ્યું.
ચકાસો
curl -sI http://localhost:8080/pixel.gif