Giter Club home page Giter Club logo

http's Introduction

AthennaIO ๐Ÿฆด

The Athenna scaffold project used by 'athenna new project' command to create your project.

GitHub followers GitHub stars

Buy Me A Coffee

GitHub language count Repository size License Commitizen

Links

For project documentation click here. If something is not clear in the documentation please open an issue in the documentation repository

Contributing

If you want to contribute to this project, first read the CONTRIBUTING.MD file. It will be a pleasure to receive your help.


With ๐Ÿ’œ by Athenna community

http's People

Contributors

jlenon7 avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

http's Issues

[Bug]: Write a better log message for the log middleware

Version

1.8.3

Steps to reproduce

Set the logHttp option in config/http.js file as true. Run the server and make a http request.

Expected behavior

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]

Actual behavior

The log has only the http method, remote address and status code.

Additional context

No response

Environment

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

[Bug]: Add a return inside the if statement of the redirectTo Request method

Version

1.8.1

Steps to reproduce

Just call the redirectTo method with two arguments, the url and the status code:

request.redirectTo('/users', 200)

Expected behavior

The redirect should happen only one time.

Actual behavior

The redirection happens two times

Additional context

No response

Environment

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

[Feature]: Get the request input nested using dot notation

๐Ÿš€ Feature Proposal

Get the request input nested using dot notation.

Motivation

Help the developer to retrieve specific information from his body input.

Example

const userName = request.input('user.name')

const name = request.input('products.0.name')
 
const names = request.input('products.*.name')

[Feature]: Add the only method to the Request class

๐Ÿš€ Feature Proposal

Add the only method to the Request class. This method will get only the specified values from the body input.

Motivation

Help the developer to select only specific fields to prevent mass assignments.

Example

const body = request.only('name', 'email')
// or
const body = request.only(['name', 'email'])

[Feature]: Add the except method to the Request class

๐Ÿš€ Feature Proposal

Add the except method to the Request class. This method will get all the values of the body input except the selected ones.

Motivation

Help the developer to select all fields, removing the ones that are not desired.

Example

const body = request.except('createdAt', 'updatedAt', 'isAdmin')
// or
const body = request.except(['createdAt', 'updatedAt', 'isAdmin'])

[Feature]: Implement Helmet integration with Server

๐Ÿš€ Feature Proposal

Implement Helmet integration with fastify-helmet for the Http server.

Motivation

More security to the Http server.

Example

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
  })

[Refactor]: Use Edge template engine instead of EJS in commands

๐Ÿš€ Feature Proposal

Use Edge template engine to create artisan "make" commands instead of EJS.

Motivation

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.

Example

No response

[Feature]: Implement Swagger documentation generator

๐Ÿš€ Feature Proposal

Implement Swagger documentation generator for routes defined using fastify-swagger.

Motivation

A good API is well documented. To facilitate the writing of documentation, we are going to set up the Swagger documentation generator for routes.

Example

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' } } })

[Bug]: Http returns empty body when using "response" method in Route to map Swagger responses

Version

1.8.3

Steps to reproduce

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' }
      }
    })

Expected behavior

I expect to map the Swagger responses without compromising the behavior of my routes.

Actual behavior

The http server is returning an empty object when adding the response method to the Route.

Additional context

No response

Environment

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

[Feature]: Add rateLimit method in Route

๐Ÿš€ Feature Proposal

Add rateLimit method in Route class.

Motivation

Configure rateLimit options for specific routes.

Example

Route.get('/hello', 'WelcomeController.show').rateLimit({ max: 1 })

[Feature]: Add the input method to the Request class

๐Ÿš€ Feature Proposal

Add the input method to the Request class. This method will do the same thing as the payload.

Motivation

The input method has a nice and understandable name about what he does.

Example

request.input('name', 'Joรฃo')

[Feature]: Update version to 3.0.0

๐Ÿš€ Feature Proposal

The version of this package needs to be updated to 3.0.0.

Motivation

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.

Example

No response

[Feature]: Add at least simple types for Swagger docs

๐Ÿš€ Feature Proposal

Add at least simple types for Swagger methods in Route.

Motivation

It is not easy to type swagger methods when working with complex types. But we could create simple versions for it at least.

Example

No response

[Feature]: create the install http command

๐Ÿš€ Feature Proposal

This feature will add the install http command:

node artisan install:http

Motivation

This command will be responsible to install the package @athenna/http and configure all it files inside the project.

Example

No response

[Bug]: Athenna packages being used as dependency

Version

1.8.6

Steps to reproduce

Same as issue #74 of @athenna/artisan but with different modules:

  • @athenna/ioc
  • @athenna/config
  • @athenna/logger
  • @athenna/artisan
  • @athenna/common

Expected behavior

I expect that when I install the version 1.0.0 of the three packages above, that @athenna/artisan package uses the same version.

Actual behavior

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.

Additional context

No response

Environment

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.