diff --git a/benchmarks/adonisjs.mjs b/benchmarks/adonisjs.mjs new file mode 100644 index 00000000..9780f464 --- /dev/null +++ b/benchmarks/adonisjs.mjs @@ -0,0 +1,31 @@ +import { createServer } from 'node:http' +import { defineConfig, Server } from '@adonisjs/http-server' +import { Logger } from '@adonisjs/logger' +import { Emitter } from '@adonisjs/events' +import { Encryption } from '@adonisjs/encryption' +import { Application } from '@adonisjs/application' + +const app = new Application(new URL('./', import.meta.url), { + environment: 'web', + importer: () => {} +}) + +await app.init() + +const encryption = new Encryption({ secret: 'averylongrandom32charslongsecret' }) + +const server = new Server( + app, + encryption, + new Emitter(app), + new Logger({ enabled: false }), + defineConfig({}) +) + +server.getRouter().get('/', async (ctx) => { + return ctx.response.send({ hello: 'world' }) +}) + +await server.boot() + +createServer(server.handle.bind(server)).listen(3000) diff --git a/lib/packages.js b/lib/packages.js index c93e61b4..bb6f2c37 100755 --- a/lib/packages.js +++ b/lib/packages.js @@ -6,6 +6,7 @@ import path from 'path'; const packages = { '0http': { hasRouter: true, package: '0http' }, + 'adonisjs': { hasRouter: true, package: '@adonisjs/http-server' }, bare: { version: process.version }, connect: {}, 'connect-router': { extra: true, package: 'router', hasRouter: true }, diff --git a/package.json b/package.json index 9c3ddad3..d2657bb1 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,11 @@ }, "license": "MIT", "dependencies": { + "@adonisjs/application": "^8.3.1", + "@adonisjs/encryption": "^6.0.2", + "@adonisjs/events": "^9.0.2", + "@adonisjs/http-server": "^7.2.3", + "@adonisjs/logger": "^6.0.3", "@hapi/hapi": "^21.1.0", "@hono/node-server": "^1.3.0", "@leizm/web": "^2.7.3",