2017-05-25 19:12:29 +00:00
# HTTPure
2021-03-22 19:34:49 +00:00
[![License ](https://img.shields.io/badge/license-MIT-blue.svg )](https://raw.githubusercontent.com/cprussin/purescript-httpure/main/License)
2017-07-10 19:38:56 +00:00
[![Latest release ](http://img.shields.io/github/release/cprussin/purescript-httpure.svg )](https://github.com/cprussin/purescript-httpure/releases)
2017-07-21 06:26:13 +00:00
[![purescript-httpure on Pursuit ](https://pursuit.purescript.org/packages/purescript-httpure/badge )](https://pursuit.purescript.org/packages/purescript-httpure)
2017-07-10 19:38:56 +00:00
2017-05-25 19:12:29 +00:00
A purescript HTTP server framework.
2017-09-26 14:47:05 +00:00
HTTPure is:
2017-10-26 21:42:08 +00:00
- Well-tested (see our [tests ](./test/Test ))
2017-09-26 14:47:05 +00:00
- Well-documented (see our [documentation ](./docs ))
- Built to take advantage of PureScript language features for flexible and
extensible routing
- Pure (no `set` , `get` , `use` , etc)
2017-05-25 19:12:29 +00:00
## Status
2017-09-26 14:47:05 +00:00
This project is currently fairly stable, but has not reached it's 1.0 release
yet. You can track what's left before it gets there by looking at our
[roadmap ](https://github.com/cprussin/purescript-httpure/projects ). The API
signatures are _mostly_ stable, but are subject to change before the 1.0 release
if there's a good reason to change them.
If you'd like to help us get to 1.0 quicker, please contribute! To get started,
2017-10-26 20:28:47 +00:00
check our [contributing guide ](./Contributing.md ).
2017-05-25 19:12:29 +00:00
## Installation
```bash
2021-11-13 07:46:59 +00:00
spago install httpure
2017-05-25 19:12:29 +00:00
```
2017-07-10 10:17:13 +00:00
## Quick Start
```purescript
module Main where
2017-09-26 14:47:05 +00:00
import Prelude (($))
2017-07-10 10:17:13 +00:00
2018-07-08 23:28:59 +00:00
import Effect.Console as Console
2017-07-10 10:17:13 +00:00
import HTTPure as HTTPure
2018-07-08 23:44:20 +00:00
main :: HTTPure.ServerM
2017-07-14 06:49:01 +00:00
main =
2017-07-14 06:43:20 +00:00
HTTPure.serve 8080 router $ Console.log "Server now up on port 8080"
2017-07-10 10:17:13 +00:00
where
2017-09-26 06:08:07 +00:00
router _ = HTTPure.ok "hello world!"
2017-07-10 10:17:13 +00:00
```
2017-05-25 19:12:29 +00:00
## Documentation
Module documentation is published
on [Pursuit ](http://pursuit.purescript.org/packages/purescript-httpure ).
2017-10-26 20:28:47 +00:00
You can also take a look at [our guides ](./docs ).
2017-07-10 10:17:13 +00:00
## Examples
2017-10-26 20:28:47 +00:00
HTTPure ships with a number of [examples ](./docs/Examples ). To run an example,
in the project root, run:
2017-07-10 10:17:13 +00:00
```bash
2021-11-17 05:50:23 +00:00
nix-shell --run 'example < Example Name > '
```
Or, without `nix` :
```bash
spago -x test.dhall run --main Examples.< Example Name > .Main
2017-07-10 10:17:13 +00:00
```
2017-05-25 19:12:29 +00:00
2017-07-10 10:17:13 +00:00
Each example's startup banner will include information on routes available on
the example server.
2017-05-25 19:12:29 +00:00
## Testing
2017-07-10 10:17:13 +00:00
To run the test suite, in the project root run:
2017-05-25 19:12:29 +00:00
```bash
2021-11-17 05:50:23 +00:00
nix-shell --run check
```
Or, if `nix` isn't your thing:
```bash
purs-tidy check src test docs & & spago -x test.dhall test
2017-05-25 19:12:29 +00:00
```
## Contributing
We are open to accepting contributions! Please see
2017-07-10 19:52:06 +00:00
the [contributing guide ](Contributing.md ).
2017-05-25 19:12:29 +00:00
## People
HTTPure is written and maintained
2018-08-09 19:51:14 +00:00
by [Connor Prussin ](https://connor.prussin.net ) and [Petri
Lehtinen](http://www.digip.org/).
2017-05-25 19:12:29 +00:00
We are open to accepting contributions! Please see
2017-10-26 20:28:47 +00:00
the [contributing guide ](./Contributing.md ).
2017-05-25 19:12:29 +00:00
## License
2017-10-26 20:28:47 +00:00
[MIT ](./License )