Popularity
1.9
Stable
Activity
0.0
Stable
4
2
0
Monthly Downloads: 8
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Latest version: v0.1.0.0
servant-wasm alternatives and similar packages
Based on the "servant" category.
Alternatively, view servant-wasm alternatives based on common mentions on social networks and blogs.
-
servant
Servat is a Haskell DSL for describing, serving, querying, mocking, documenting web applications and more! -
servant-generate
Generate default implementations for servers in a flexible way (a.k.a servant-mock on steroids)
InfluxDB - Purpose built for real-time analytics at any scale.
InfluxDB Platform is powered by columnar analytics, optimized for cost-efficient storage, and built with open data standards.
Promo
www.influxdata.com
Do you think we are missing an alternative of servant-wasm or a related project?
README
servant-wasm
Content-Type support for delivering WASM with servant
Usage
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Monad.IO.Class (liftIO)
import qualified Data.ByteString as B
import Data.ByteString (ByteString)
import Data.Proxy (Proxy (Proxy))
import Network.Wai.Handler.Warp (run)
import Servant.Server (serve, Handler)
import Servant.API ((:>), Get)
import Servant.WASM (WASM)
type API = "wasm" :> Get '[WASM] ByteString
main :: IO ()
main = do
putStrLn "Running on 3000..."
run 3000 (serve (Proxy @ API) wasmHandler)
wasmHandler :: Handler ByteString
wasmHandler = liftIO (B.readFile "hello.wasm")
and corresponding JS to fetch WASM client-side.
const importObject = {};
WebAssembly.instantiateStreaming(fetch('/wasm'), importObject).then(results => {
// Do something with the results!
});
*Note that all licence references and agreements mentioned in the servant-wasm README section above
are relevant to that project's source code only.