Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Woody88/purescript-warp
Purescript server library based on WAI. Inspired by the Haskell version.
https://github.com/Woody88/purescript-warp
http-server purescript server wai warp
Last synced: about 1 month ago
JSON representation
Purescript server library based on WAI. Inspired by the Haskell version.
- Host: GitHub
- URL: https://github.com/Woody88/purescript-warp
- Owner: Woody88
- License: mit
- Created: 2019-12-24T05:13:26.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-08T16:12:02.000Z (almost 4 years ago)
- Last Synced: 2024-08-02T13:34:02.788Z (5 months ago)
- Topics: http-server, purescript, server, wai, warp
- Language: PureScript
- Homepage:
- Size: 82 KB
- Stars: 23
- Watchers: 4
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Woody88/purescript-warp/blob/master/LICENSE)
![CI](https://github.com/Woody88/purescript-warp/workflows/CI/badge.svg?branch=master)
# WarpA server handler for WAI which wraps node's http module.
Table of Contents
-----------------* [Installation](#installation)
* [Usage](#usage)
* [Contributing](#contributing)
* [Changelog](#changelog)
* [License](#license)## Installation
***This library is not yet published to pursuit.***
You can install this package by adding the details below to your packages.dhall:Using Spago
```dhall
let additions =
{ warp =
{ dependencies = [ "console", "effect", "generics-rep", "node-fs-aff", "node-http", "wai" ]
, repo = "https://github.com/Woody88/purescript-warp.git"
, version = "master"
}
, wai =
{ dependencies = [ "aff", "effect", "http-types", "node-net" ]
, repo = "https://github.com/Woody88/purescript-wai.git"
, version = "master"
}
, http-types =
{ dependencies = [ "tuples", "unicode", "generics-rep" ]
, repo = "https://github.com/Woody88/purescript-http-types.git"
, version = "master"
}
}
``````console
user@user:~$ spago install warp
```## Usage
### Hello World
```purescript
import Preludeimport Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect.Class.Console as Console
import Network.HTTP.Types (ok200)
import Network.HTTP.Types.Header (hContentType)
import Network.Wai (Application, responseStr)
import Network.Warp.Run (runSettings)
import Network.Warp.Settings (defaultSettings)main :: Effect Unit
main = do
let beforeMainLoop = Console.log $ "Listening on port " <> show defaultSettings.port
void $ runSettings defaultSettings { beforeMainLoop = beforeMainLoop } appapp :: Application
app req f = do
f $ responseStr ok200 [(hContentType /\ "text/plain")] "Hello, World!"
```## Contributing
If you are interested in fixing issues and contributing directly to the code base,
please see the [contributing guidelines](https://github.com/Woody88/purescript-warp/blob/master/CONTRIBUTING.md).## Changelog
Change log details can be found [here](https://github.com/Woody88/purescript-warp/blob/master/CHANGELOG.md)
## License
Licensed under the [MIT](https://github.com/Woody88/purescript-warp/blob/master/LICENSE) license.
Copyright (c) 2021 Woodson Delhia. All rights reserved.