hs-server-starter: Write a server supporting Server::Starter's protocol in Haskell

[ bsd3, library, value ] [ Propose Tags ] [ Report a vulnerability ]

Provides a utility to write server program which can be called via Perl's https://github.com/kazuho/p5-Server-Starter program using Haskell. This module does not provide a Haskell implementation of start_server, so you need to use the original Perl version or use a version ported to golang.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Flags

Automatic Flags
NameDescriptionDefault
example

Build the example application

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.1.0, 0.1.2.0
Dependencies base (>=4.7 && <5), directory (>=1.3.0.0 && <1.4), hs-server-starter, http-types, network (>=2.6.3.1 && <3.2), wai, warp [details]
License BSD-3-Clause
Copyright Copyright 2017- hiratara
Author Masahiro Honma
Maintainer hiratara@cpan.org
Category value
Home page https://github.com/hiratara/hs-server-starter#readme
Bug tracker https://github.com/hiratara/hs-server-starter/issues
Source repo head: git clone https://github.com/hiratara/hs-server-starter
Uploaded by hiratara at 2020-03-15T10:48:59Z
Distributions NixOS:0.1.2.0
Reverse Dependencies 1 direct, 0 indirect [details]
Executables server-starter-warp-example
Downloads 2379 total (26 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2020-03-15 [all 1 reports]

Readme for hs-server-starter-0.1.1.0

[back to package description]

hs-server-starter

Description

Provides a utility to write server program which can be called via Perl's [https://github.com/kazuho/p5-Server-Starter](start_server) program using Haskell.

This module does not provide a Haskell implementation of start_server, so you need to use the original Perl version or use a version ported to golang.

SINOPSIS

Since the listenAll function returns a listened Network.Socket, please call accept on it.

import qualified Network.ServerStarter.Socket as Starter
import qualified Network.Socket               as Socket
import qualified Network.Wai                  as Wai
import qualified Network.Wai.Handler.Warp     as Warp

main :: IO ()
main = do
  (socket:_) <- Starter.listenAll
  Socket.SockAddrInet port _ <- Socket.getSocketName socket
  let setting = Warp.setPort (fromEnum port)
              $ Warp.defaultSettings
  Warp.runSettingsSocket setting socket app

app :: Wai.Application
app = ...

Then run start_server and access to http://localhost:12345 .

$ start_server --port 12345 -- stack exec server-starter-warp-example

Author

Masahiro Honma (hiratara@cpan.org)