athennaio / http Goto Github PK
View Code? Open in Web Editor NEW๐ก The Athenna Http server application. Built on top of fastify.
Home Page: https://athenna.io
License: MIT License
๐ก The Athenna Http server application. Built on top of fastify.
Home Page: https://athenna.io
License: MIT License
Add at least simple types for Swagger methods in Route
.
It is not easy to type swagger methods when working with complex types. But we could create simple versions for it at least.
No response
Use Edge template engine to create artisan "make" commands instead of EJS.
The @athenna/mail package will use Edge template engine to write email templates. To keep the same pattern and behavior from @athenna/mail we are going to use the Edge template engine in Artisan make commands.
No response
1.8.3
Set the logHttp
option in config/http.js
file as true
. Run the server and make a http request.
I expect to see more information about the request, such as:
:remote-addr - :remote-user [:date[clf]] ":method :url HTTP/:http-version" :status :res[content-length]
The log has only the http method, remote address and status code.
No response
System:
OS: Linux 5.14 Ubuntu 20.04.5 LTS (Focal Fossa)
CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz
Memory: 6.19 GB / 15.03 GB
Container: Yes
Shell: 5.8 - /usr/bin/zsh
Binaries:
Node: 16.18.0 - ~/.nvm/versions/node/v16.18.0/bin/node
npm: 8.19.2 - ~/.nvm/versions/node/v16.18.0/bin/npm
1.8.3
Just create a route implementation that returns some object and add the response
method to map the Swagger responses.
Example:
Route.post('/hello', ctx => ctx.response.status(200).send({ hello: 'world' }))
.response(200, {
description: 'Hello World!',
properties: {
hello: { type: 'string' }
}
})
I expect to map the Swagger responses without compromising the behavior of my routes.
The http server is returning an empty object when adding the response
method to the Route
.
No response
System:
OS: Linux 5.14 Ubuntu 20.04.5 LTS (Focal Fossa)
CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz
Memory: 6.19 GB / 15.03 GB
Container: Yes
Shell: 5.8 - /usr/bin/zsh
Binaries:
Node: 16.18.0 - ~/.nvm/versions/node/v16.18.0/bin/node
npm: 8.19.2 - ~/.nvm/versions/node/v16.18.0/bin/npm
This feature will add the install http command:
node artisan install:http
This command will be responsible to install the package @athenna/http
and configure all it files inside the project.
No response
1.8.6
Same as issue #74 of @athenna/artisan but with different modules:
I expect that when I install the version 1.0.0 of the three packages above, that @athenna/artisan
package uses the same version.
Two versions of the packages are installed, specifics for @athenna/artisan
and the other for the project. This means that I can't choose which version of the packages I want to use globally in the project.
No response
System:
OS: Linux 5.14 Ubuntu 20.04.5 LTS (Focal Fossa)
CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz
Memory: 6.19 GB / 15.03 GB
Container: Yes
Shell: 5.8 - /usr/bin/zsh
Binaries:
Node: 16.18.0 - ~/.nvm/versions/node/v16.18.0/bin/node
npm: 8.19.2 - ~/.nvm/versions/node/v16.18.0/bin/npm
Add rateLimit
method in Route class.
Configure rateLimit
options for specific routes.
Route.get('/hello', 'WelcomeController.show').rateLimit({ max: 1 })
Implement Swagger documentation generator for routes defined using fastify-swagger.
A good API is well documented. To facilitate the writing of documentation, we are going to set up the Swagger documentation generator for routes.
The developer should be able to choose if he wants to set up swagger or not in http.js
config file:
/*
|--------------------------------------------------------------------------
| No swagger
|--------------------------------------------------------------------------
|
| This value defines if HttpKernel will set Swagger plugin or not.
|
*/
noSwagger: false
The developer should be able to set the base swagger configurations in http.js
config file:
/*
|--------------------------------------------------------------------------
| Swagger
|--------------------------------------------------------------------------
|
| Setup your base Swagger configuration.
|
*/
swagger: {
info: {
title: 'Test swagger',
description: 'Testing the Athenna swagger API',
version: '0.1.0'
},
externalDocs: {
url: 'https://swagger.io',
description: 'Find more info here'
},
host: 'localhost',
schemes: ['http'],
consumes: ['application/json'],
produces: ['application/json'],
tags: [
{ name: 'user', description: 'User related end-points' },
{ name: 'code', description: 'Code related end-points' }
],
definitions: {
User: {
type: 'object',
required: ['id', 'email'],
properties: {
id: { type: 'string', format: 'uuid' },
firstName: { type: 'string' },
lastName: { type: 'string' },
email: {type: 'string', format: 'email' }
}
}
},
securityDefinitions: {
apiKey: {
type: 'apiKey',
name: 'apiKey',
in: 'header'
}
}
}
The developer should be able to set up the swagger schema for each route:
Route.get('/', ({ response }) => response.status(200).send({ hello: 'world' })).swaggerOptions({
schema: {
description: 'Hello world',
tags: ['hello'],
response: {
200: {
description: 'Successful response',
type: 'object',
properties: {
hello: { type: 'string' }
},
},
},
}
})
Or using a more simple configuration with builder pattern:
Route.get('/', ({ response }) => response.status(200).send({ hello: 'world' }))
.description('Hello world')
.tags('hello')
.response(200, { description: 'Successful response', type: 'object', properties: { hello: { type: 'string' } } })
Create request
method in Http class to run requests in the fastify server. Same as inject (https://www.fastify.io/docs/latest/Guides/Testing/)
1.0.3
Add the except
method to the Request class. This method will get all the values of the body input except the selected ones.
Help the developer to select all fields, removing the ones that are not desired.
const body = request.except('createdAt', 'updatedAt', 'isAdmin')
// or
const body = request.except(['createdAt', 'updatedAt', 'isAdmin'])
The version of this package needs to be updated to 3.0.0.
We are going to start versioning the Athenna packages using Semver. All packages of Athenna will be updated to version 3.0.0 to start following Semver rules.
No response
Get the request input nested using dot notation.
Help the developer to retrieve specific information from his body input.
const userName = request.input('user.name')
const name = request.input('products.0.name')
const names = request.input('products.*.name')
Add the only
method to the Request class. This method will get only the specified values from the body input.
Help the developer to select only specific fields to prevent mass assignments.
const body = request.only('name', 'email')
// or
const body = request.only(['name', 'email'])
1.8.1
Just call the redirectTo
method with two arguments, the url and the status code:
request.redirectTo('/users', 200)
The redirect should happen only one time.
The redirection happens two times
No response
System:
OS: Linux 5.14 Ubuntu 20.04.5 LTS (Focal Fossa)
CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz
Memory: 6.19 GB / 15.03 GB
Container: Yes
Shell: 5.8 - /usr/bin/zsh
Binaries:
Node: 16.18.0 - ~/.nvm/versions/node/v16.18.0/bin/node
npm: 8.19.2 - ~/.nvm/versions/node/v16.18.0/bin/npm
Add the input
method to the Request class. This method will do the same thing as the payload
.
The input
method has a nice and understandable name about what he does.
request.input('name', 'Joรฃo')
Implement Helmet integration with fastify-helmet
for the Http server.
More security to the Http server.
The developer should be able to choose if he wants to set up helmet or not in http.js
config file:
/*
|--------------------------------------------------------------------------
| No Helmet
|--------------------------------------------------------------------------
|
| This value defines if HttpKernel will set Helmet plugin or not.
|
*/
noHelmet: false
The developer should be able to set the base helmet configurations in http.js
config file:
/*
|--------------------------------------------------------------------------
| Helmet
|--------------------------------------------------------------------------
|
| Setup your base Helmet configuration.
|
*/
helmet: {
global: true,
contentSecurityPolicy: false
}
The developer should set helmet configurations pet route with the helmetOptions
method:
Route.get('/', ({ response }) => response.status(200).send({ hello: 'world' }))
.helmetOptions({
dnsPrefetchControl: {
allow: true
},
expectCt: {
maxAge: 1,
enforce: true,
reportUri: 'foo'
},
frameguard: {
action: 'foo'
},
referrerPolicy: false
})
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.