pluviouse commited on
Commit
d9f570b
·
verified ·
1 Parent(s): e3ffd2a

Update app.ts

Browse files
Files changed (1) hide show
  1. app.ts +9 -0
app.ts CHANGED
@@ -14,6 +14,15 @@ const app = new Elysia()
14
  }))
15
  .get("/", () => "Hello, Elysia!")
16
  .get("/items/:id", ({ params }) => `Item ID: ${params.id}`)
 
 
 
 
 
 
 
 
 
17
  .listen(process.env.PORT);
18
 
19
  console.log(`🦊 Elysia is running at http://localhost:7680`);
 
14
  }))
15
  .get("/", () => "Hello, Elysia!")
16
  .get("/items/:id", ({ params }) => `Item ID: ${params.id}`)
17
+ .get('/stream', function* () {
18
+ yield 'Hello'
19
+ yield 'World'
20
+ })
21
+ .ws('/realtime', {
22
+ message(ws, message) {
23
+ ws.send('got:' + message)
24
+ }
25
+ })
26
  .listen(process.env.PORT);
27
 
28
  console.log(`🦊 Elysia is running at http://localhost:7680`);