Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jaredly/reason-simple-server
A simple server library for native reason
https://github.com/jaredly/reason-simple-server
Last synced: 23 days ago
JSON representation
A simple server library for native reason
- Host: GitHub
- URL: https://github.com/jaredly/reason-simple-server
- Owner: jaredly
- Created: 2018-01-05T06:14:45.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-03T17:22:09.000Z (about 6 years ago)
- Last Synced: 2024-10-03T12:24:10.508Z (about 1 month ago)
- Language: OCaml
- Homepage:
- Size: 7.81 KB
- Stars: 42
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Reason Simple Server
This is a library for native reason (with bsb-native) that lets you stand up a simple server without too much trouble.
## Basic Server
```
open ReasonSimpleServer.Basic.Response;let handler = (method, path, headers) => {
switch (method, path) {
| ("GET", "/") => {
Ok("text/plain", "All clear boss!")
}
| ("POST", _) => Bad(401, "Can't do that")
| ("Get", "/") => Ok("text/html", "Howdy
")
}
};ReasonSimpleServer.Basic.listen(~port=3451, handler);
```There's lots of features missing, but it's very small and light.
## Static Server
```
ReasonSimpleServer.Static.run(~port=3451, "./");
```