-
-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
319 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ trace | |
*.tsbuildinfo | ||
.wrangler | ||
.elysia | ||
heap.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
import { Elysia, t } from '../src' | ||
import { req } from '../test/utils' | ||
import { Elysia } from '../src' | ||
|
||
const app = new Elysia().get('/', () => 'Static Content') | ||
const app = new Elysia() | ||
.ws('/ws/:id', { | ||
message(ws, message) { | ||
ws.send(message) | ||
} | ||
}) | ||
// .get('/ws/:id', () => 'hi') | ||
.listen(3000) | ||
|
||
console.dir(app, { depth: 10 }) | ||
// console.log(app.fetch.toString()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Elysia, t } from '../src' | ||
import Page from './index.html' | ||
|
||
new Elysia() | ||
.get('/', Page) | ||
.get('/mika.mp4', Bun.file('test/kyuukurarin.mp4')) | ||
.listen(3000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<title>Bun HTML Import</title> | ||
</head> | ||
<body> | ||
<h1>Hi</h1> | ||
<video> | ||
<!-- <source src="/mika.mp4" type="video/mp4" /> --> | ||
</video> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { t } from '../../src' | ||
import { Memoirist } from 'memoirist' | ||
|
||
const total = 1000 | ||
const stack: Memoirist<any>[] = [] | ||
|
||
{ | ||
const t1 = performance.now() | ||
const memory = process.memoryUsage().heapTotal / 1024 / 1024 | ||
|
||
for (let i = 0; i < total; i++) { | ||
for (let i = 0; i < 2; i++) { | ||
const router = new Memoirist() | ||
router.add('GET', '/a', () => 'Hello, World!') | ||
router.add('GET', '/b', () => 'Hello, World!') | ||
|
||
stack.push(router) | ||
} | ||
} | ||
|
||
const memoryAfter = process.memoryUsage().heapTotal / 1024 / 1024 | ||
const took = performance.now() - t1 | ||
|
||
console.log( | ||
Intl.NumberFormat().format(total), | ||
'routes took', | ||
+took.toFixed(4), | ||
'ms' | ||
) | ||
console.log('Average', +(took / total).toFixed(4), 'ms / route') | ||
|
||
console.log(memoryAfter - memory, 'MB memory used') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.