Skip to content

Commit 72c89db

Browse files
committed
🎉 release: 1.3
1 parent d39ea95 commit 72c89db

File tree

2 files changed

+4
-29
lines changed

2 files changed

+4
-29
lines changed

example/a.ts

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,9 @@
11
import { Elysia, t } from '../src'
22

33
const app = new Elysia()
4-
.onError(({ code, error }) => {
5-
console.error('[error]', error)
6-
return { error: { code } }
4+
.get('/', ({ request }) => {
5+
request.url
76
})
8-
.get(
9-
'/session',
10-
({ error, cookie: { sessionToken } }) => {
11-
const refreshed = !!sessionToken.value
12-
13-
sessionToken.set({
14-
value: Math.random().toString(36).substring(2, 8),
15-
maxAge: 1000 * 60 * 60 * 24 * 7
16-
})
17-
18-
if (refreshed) throw error('Unauthorized')
19-
20-
return sessionToken.value
21-
},
22-
{
23-
cookie: t.Cookie(
24-
{ sessionToken: t.Optional(t.String()) },
25-
{
26-
sign: ['sessionToken'],
27-
secrets: 'my-secret'
28-
}
29-
)
30-
}
31-
)
327
.listen(3000)
338

34-
console.log(app.routes[0].compile().toString())
9+
// console.log(app.routes[0].compile().toString())

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "elysia",
33
"description": "Ergonomic Framework for Human",
4-
"version": "1.3.0-exp.77",
4+
"version": "1.3.0",
55
"author": {
66
"name": "saltyAom",
77
"url": "https://github.com/SaltyAom",

0 commit comments

Comments
 (0)