emptygif
ભાષા: ગુજરાતી

બધી ભાષાઓ અને ફ્રેમવર્ક

Scotty Haskell

Scotty માટે Haskell સ્નિપેટ, જે /pixel.gif પરની રિક્વેસ્ટનો જવાબ empty GIF થી આપે છે. GIF સ્ટાર્ટઅપ વખતે એક જ વાર ડિકોડ થાય છે.

Scotty Haskell

ઇન્સ્ટૉલ
build-depends: base, bytestring, base64-bytestring, scotty
ફાઇલ
Main.hs
ચલાવો
cabal run
{-# 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

ફ્રેમવર્કના હાલના ડૉક્યુમેન્ટેશન સાથે મેળવીને ચકાસ્યું.

ચકાસો

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

સત્તાવાર સાઇટ: Scotty

Haskell માં વધુ