This file contains hidden or 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 is a proof of concept implementation since | |
| // Mapl doesn't have built-in signer yet | |
| import { jitc, router, staticException } from '@mapl/app'; | |
| import jwt from 'jsonwebtoken'; | |
| import Signer from '@bit-js/ncrypt/basic-signer'; | |
| import ValueSigner from '@bit-js/ncrypt/value-signer'; | |
| const SECRET = 'linux'; |
This file contains hidden or 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
| import { group, run, bench } from 'mitata'; | |
| // Do warmup | |
| for (let i = 0; i < 10; i++) bench('noop', () => { }); | |
| group('Set vs array vs literal', () => { | |
| // Do checks with arrays | |
| const arr = ['hi', 'there', 'nagna', 'randomlongstring', 'small']; | |
| const arrInclude = (item) => arr.includes(item); |
This file contains hidden or 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
| Stric x 45827 req/sec | |
| Vix x 45412 req/sec | |
| Elysia x 44004 req/sec | |
| Hono x 42643 req/sec | |
| Bunicorn x 39660 req/sec | |
| Fastest is Stric. |
This file contains hidden or 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
| import { Router, macro } from '@stricjs/router'; | |
| import { qs } from '@stricjs/utils'; | |
| // Create a query parser that only search for key `name` in the query | |
| const parse = qs.searchKey('name'); | |
| export default new Router({ base: 'http://localhost:3000' }) | |
| // Return 'Hi' on every requests to '/' | |
| .get('/', macro('Hi')) | |
| // Yield back the JSON that the request sent |
NewerOlder