Skip to content

Commit

Permalink
Add AdonisJS (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainLanz authored Oct 18, 2024
1 parent dbb3c01 commit 12b3a07
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
31 changes: 31 additions & 0 deletions benchmarks/adonisjs.mjs
Original file line number Diff line number Diff line change
@@ -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)
1 change: 1 addition & 0 deletions lib/packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 12b3a07

Please sign in to comment.