-
-
Notifications
You must be signed in to change notification settings - Fork 231
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
1 parent
dbb3c01
commit 12b3a07
Showing
3 changed files
with
37 additions
and
0 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 |
---|---|---|
@@ -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) |
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