Skip to content

Commit e105e3b

Browse files
authored
docs: Warn users about export Elysia as a default
Fixes elysiajs/elysia#550
1 parent f6035ff commit e105e3b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/essential/route.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,16 @@ We can define a route by calling a **method named after HTTP verbs**, passing a
4949
```typescript twoslash
5050
import { Elysia } from 'elysia'
5151

52-
new Elysia()
52+
export const app = new Elysia()
5353
.get('/', () => 'hello')
5454
.get('/hi', () => 'hi')
5555
.listen(3000)
5656
```
5757

58+
::: warning
59+
Do **not** `export default app` as Bun's [auto-execution](https://bun.sh/docs/api/http#object-syntax) feature will cause the Elysia server to run twice.
60+
:::
61+
5862
We can access the web server by going to **http://localhost:3000**
5963

6064
By default, web browsers will send a GET method when visiting a page.

0 commit comments

Comments
 (0)