@athenna/http 4.10.0 → 4.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@athenna/http",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.12.0",
|
|
4
4
|
"description": "The Athenna Http server. Built on top of fastify.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "João Lenon <lenon@athenna.io>",
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"src/**/*.js",
|
|
40
40
|
"src/**/*.d.ts",
|
|
41
41
|
"templates",
|
|
42
|
-
"configurer"
|
|
42
|
+
"configurer",
|
|
43
|
+
"resources"
|
|
43
44
|
],
|
|
44
45
|
"type": "module",
|
|
45
46
|
"main": "./src/index.js",
|
|
@@ -71,14 +72,14 @@
|
|
|
71
72
|
"#tests": "./tests/index.js"
|
|
72
73
|
},
|
|
73
74
|
"devDependencies": {
|
|
74
|
-
"@athenna/artisan": "^4.
|
|
75
|
-
"@athenna/common": "^4.
|
|
76
|
-
"@athenna/config": "^4.
|
|
77
|
-
"@athenna/ioc": "^4.
|
|
78
|
-
"@athenna/logger": "^4.
|
|
79
|
-
"@athenna/test": "^4.
|
|
80
|
-
"@athenna/tsconfig": "^4.
|
|
81
|
-
"@athenna/view": "^4.
|
|
75
|
+
"@athenna/artisan": "^4.14.0",
|
|
76
|
+
"@athenna/common": "^4.18.0",
|
|
77
|
+
"@athenna/config": "^4.7.0",
|
|
78
|
+
"@athenna/ioc": "^4.7.0",
|
|
79
|
+
"@athenna/logger": "^4.8.0",
|
|
80
|
+
"@athenna/test": "^4.12.0",
|
|
81
|
+
"@athenna/tsconfig": "^4.9.1",
|
|
82
|
+
"@athenna/view": "^4.6.0",
|
|
82
83
|
"@fastify/cors": "^8.4.0",
|
|
83
84
|
"@fastify/helmet": "^11.1.1",
|
|
84
85
|
"@fastify/rate-limit": "^8.0.3",
|
|
@@ -64,7 +64,15 @@ export class HttpKernel {
|
|
|
64
64
|
}
|
|
65
65
|
if (swaggerUiPlugin) {
|
|
66
66
|
debug('Not able to register swagger-ui plugin. Install @fastify/swagger-ui package.');
|
|
67
|
-
|
|
67
|
+
const swaggerUiConfig = Config.get('http.swagger.ui', {});
|
|
68
|
+
if (!swaggerUiConfig.logo) {
|
|
69
|
+
const image = new File(Path.resources('images/athenna-logo.png'));
|
|
70
|
+
swaggerUiConfig.logo = {
|
|
71
|
+
type: 'image/png',
|
|
72
|
+
content: image.getContentSync()
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
await Server.plugin(swaggerUiPlugin, swaggerUiConfig);
|
|
68
76
|
}
|
|
69
77
|
}
|
|
70
78
|
/**
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Controller, type Context } from '@athenna/http'
|
|
2
|
+
|
|
3
|
+
@Controller()
|
|
4
|
+
export class {{ namePascal }} {
|
|
5
|
+
public async index({ response }: Context): Promise<void> {
|
|
6
|
+
return response.status(200).send([{}])
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
public async store({ response }: Context): Promise<void> {
|
|
10
|
+
return response.status(201).send({})
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public async show({ response }: Context): Promise<void> {
|
|
14
|
+
return response.status(200).send({})
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public async update({ response, params }: Context): Promise<void> {
|
|
18
|
+
return response.status(200).send({ id: params.id })
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public async delete({ response }: Context): Promise<void> {
|
|
22
|
+
return response.status(204)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Interceptor } from '@athenna/http'
|
|
2
|
+
import type { InterceptorContract, InterceptContext } from '@athenna/http'
|
|
3
|
+
|
|
4
|
+
@Interceptor()
|
|
5
|
+
export class {{ namePascal }} implements InterceptorContract {
|
|
6
|
+
public async intercept(ctx: InterceptContext): Promise<unknown> {
|
|
7
|
+
return ctx.body
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Terminator } from '@athenna/http'
|
|
2
|
+
import type { TerminateContext, TerminatorContract } from '@athenna/http'
|
|
3
|
+
|
|
4
|
+
@Terminator()
|
|
5
|
+
export class {{ namePascal }} implements TerminatorContract {
|
|
6
|
+
public async terminate(ctx: TerminateContext): Promise<void> {}
|
|
7
|
+
}
|