- Notifications
You must be signed in to change notification settings - Fork4
🪁 A simple, type-safe http server for PureScript
License
sigma-andex/purescript-httpurple
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A functional http server with a focus on type-safety and making the common case easy.
Note: If you are looking for a http client, check outpurescript-fetch
Note: This project was originally forked from the amazingHTTPure http server framework, but has since deviated quite a bit. If you are coming from HTTPure you might want to have a look at thedifferences to HTTPure.
- λ fp-style http server & request handlers
- 🛣 Powerful & type-safe routing dsl
- 🕵🏻♂️ Easy json parsing and data validation
- 🥪 Supports Node/Express middlewares
- 📜 Extensive documentation & examples
spago install httpurple
moduleMainwhereimportPreludehiding ((/))importHTTPurpledataRoute =HelloStringderive instanceGenericRoute_route::RouteDuplex'Routeroute = mkRoute {"Hello":"hello" / segment }main::ServerMmain = serve { port:8080 } { route, router } where router { route:Hello name } = ok $"hello" <> name
then start the server
➜ spago run Src Lib AllWarnings 0 0 0 Errors 0 0 0 [info] Build succeeded.HTTPurple 🪁 up and running on http://0.0.0.0:8080
query your server, e.g. usinghttpie
➜ http http://localhost:8080/hello/🗺 HTTP/1.1 200 OKConnection: keep-aliveContent-Length: 10Date: Sun, 22 May 2022 16:50:52 GMTKeep-Alive: timeout=5hello 🗺
See thedocs folder for the in-depth guides.
- Basics - Basic introduction to HTTPurple 🪁
- Routing - Explanation of the routing dsl
- Requests - Guide to request handling
- Response - Guide to response handling
- Middleware - Guide to HTTPurple and Node.js middlewares
- Differences - A detailed description of the differences to HTTPure
HTTPurple ships with a number ofexamples. To run an example,in the project root, run:
spago -x test.dhall run --main Examples.<Example Name>.Main
Each example's startup banner will include information on routes available onthe example server.
To run the test suite, in the project root run:
spago -x test.dhalltestThis is a fork ofHTTPure, which is licensed under MIT. See theoriginal license. This work is similarly licensed underMIT.
About
🪁 A simple, type-safe http server for PureScript
Topics
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.