Skip to content

Mount default express middleware #4

@mateusnroll

Description

@mateusnroll

Some express modules should be mounted by default in every project, and ike should come with that right out of the box (right out of the command line? 👍). So what should it be, you ask? Let's think.

What middlewares to use?

  • Gzipping, through compression. Enables gzip for every request by default, cutting the size of the requests. This should be a default, and then the developer can disable it.
  • Body parsing, through body-parser. Any application that deals with post requests (which is almost everything) should be able to parse the request body.
  • Server-side session, through express-session. Handling a session data from the server is something most apps use, except the ones that are based on APIs. Still think it goes well into ike's stack.

How to make it happen?

  • Any configuration should be on the yaml configuration files. Reading it from there will make it easier to set it up and refer to configuration later on.
  • It should be easy to decouple middlewares. Commenting or removing a couple lines (preferably one) should do the trick. It helps if the method and module names are descriptive. Or if the file is well-commented. Or both.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions