emptygif
Wika: Filipino

Lahat ng language at framework

Oxygen.jl Julia

Isang Julia snippet para sa Oxygen.jl na sumasagot sa mga request sa /pixel.gif gamit ang empty GIF, na isang beses lang dine-decode sa startup.

Oxygen.jl Julia

I-install
julia -e 'using Pkg; Pkg.add(["Oxygen", "HTTP"])'
File
server.jl
Patakbuhin
julia server.jl
using Base64
using HTTP
using Oxygen

const GIF = base64decode("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==")

@get "/pixel.gif" function (req::HTTP.Request)
    HTTP.Response(200, ["Content-Type" => "image/gif", "Cache-Control" => "no-store"], GIF)
end

serve(host = "0.0.0.0", port = 8080)

Pinatakbo namin ang snippet na ito at ikinumpara ang mga byte na ibinalik nito.

Suriin

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

Opisyal na site: Oxygen.jl

Iba pa sa Julia