Lahat ng language at framework
Scotty Haskell
Isang Haskell snippet para sa Scotty na sumasagot sa mga request sa /pixel.gif gamit ang empty GIF, na isang beses lang dine-decode sa startup.
Scotty Haskell
{-# LANGUAGE OverloadedStrings #-}
import qualified Data.ByteString.Base64 as Base64
import qualified Data.ByteString.Lazy as BL
import Web.Scotty
-- A top-level constant: decoded once, on first use.
gif :: BL.ByteString
gif = BL.fromStrict (Base64.decodeLenient "R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==")
main :: IO ()
main = scotty 8080 $
get "/pixel.gif" $ do
setHeader "Content-Type" "image/gif"
setHeader "Cache-Control" "no-store"
raw gif
Sinuri batay sa kasalukuyang dokumentasyon ng framework.
Suriin
curl -sI http://localhost:8080/pixel.gif