Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jderochervlk/rescript-dream
A functional ReScript server framework for Javascript runtimes
https://github.com/jderochervlk/rescript-dream
Last synced: 9 days ago
JSON representation
A functional ReScript server framework for Javascript runtimes
- Host: GitHub
- URL: https://github.com/jderochervlk/rescript-dream
- Owner: jderochervlk
- Created: 2024-05-17T03:45:09.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-05-20T20:27:06.000Z (7 months ago)
- Last Synced: 2024-05-21T04:48:45.396Z (7 months ago)
- Language: ReScript
- Size: 54.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @jvlk/rescript-dream
A functional ReScript server framework for Javascript runtimes.
Currently supports Express and Bun.Inspired and heavily based on [Dream for OCaml](https://aantron.github.io/dream/).
## Installation
```bash
npm i @jvlk/rescript-dream
```
Modify your project's `rescript.json` file.
```diff
{
"bs-dependencies": [
+ "@jvlk/rescript-dream"
]
}
```You might also want some JSX bindings to support returning HTML from the server. You can use any JSX bindings you like, but I recommend [`@jvlk/rescript-lite-jsx`](https://github.com/jderochervlk/rescript-lite-jsx).
## Example
Check out the example folder for more examples, but here's a basic server with HTMX.```rescript
let router = Dream.router([
Dream.get("/", async _ => {
Dream.html(
{Lite.string("Get data")}
,
)
}),
Dream.get("/data", async _ => {
Dream.html({"Data!"->Lite.string})
}),
])// You can also use DreamExpress.run
let _ = DreamBun.run(router->Dream.logger)
```