aboutsummaryrefslogtreecommitdiff
path: root/docs/guides/ecosystem/stric.md
blob: 102bd339fb0d110012d05c86a9cd6f2150cb33cc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
name: Build an HTTP server using StricJS and Bun
---

[StricJS](https://github.com/bunsvr) is a minimalist, fast web framework for Bun. Use `bun init` to create an empty project.

```bash
$ mkdir myapp
$ cd myapp
$ bun init
$ bun add @stricjs/router
```

---

To implement a simple HTTP server with StricJS:

```ts#index.ts
import { Router } from '@stricjs/router';

export default new Router()
  .get('/', () => new Response('Hi'));
```

---

To serve static files from `/public/*`:

```ts#index.ts
export default new Router()
  .get('/', () => new Response('Hi'))
  .get('/public/*', stream('.'));
```

---

Run the file in watch mode to start the development server.

```bash
$ bun --watch run index.ts
```

---

For more info, see Stric's [documentation](https://stricjs.gitbook.io/docs).