Skip to content

Commit

Permalink
feat: add cors and rate limit plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jlenon7 committed Apr 12, 2022
1 parent 693089f commit dfae7fa
Show file tree
Hide file tree
Showing 4 changed files with 384 additions and 37 deletions.
135 changes: 106 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@athenna/core",
"version": "1.2.7",
"version": "1.2.8",
"description": "",
"license": "MIT",
"author": "João Lenon <[email protected]>",
Expand Down Expand Up @@ -161,7 +161,7 @@
"@athenna/config": "1.0.8",
"@athenna/ioc": "1.1.3",
"@athenna/logger": "1.1.7",
"@athenna/http": "1.2.4",
"@athenna/http": "1.2.6",
"@secjs/utils": "1.8.3",
"reflect-metadata": "0.1.13",
"tscpaths": "0.0.9"
Expand Down
10 changes: 8 additions & 2 deletions src/Application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,18 @@ export class Application {
private async resolveHttpKernel() {
const { dir, name } = parse(Path.app('Http/Kernel'))

const HttpKernel = resolveModule(
const Kernel = resolveModule(
await import(`${dir}/${name}${this.extension}`),
)

const kernel = new Kernel()

this.logger.success('Booting the Http Kernel')

await new HttpKernel().registerMiddlewares()
await kernel.registerCors()
await kernel.registerRateLimit()
await kernel.registerErrorHandler()
await kernel.registerLogMiddleware()
await kernel.registerMiddlewares()
}
}
Loading

0 comments on commit dfae7fa

Please sign in to comment.