1.0.3 • Published 2 years ago

express-constructor v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Express constructor

With express-constructor you can build faster any kind of API. You only need to specify the routes an that's it, we help you to generate the built in code that you need.

Roadmap

Do not forget to check our roadmap, here we add all the features were working on at the moment. We appreciate all the help :)

:rocket: Open-roadmap

Installation

npm i express-constructor

How to use?

  1. Create a routes.json file specifying all your routes needed, like in the following example:
  {
    "appName": {
      "root": "/",
      "routes": [
        {
          "method": "path"
        }
      ]
    }
  }
  1. Run the following command from the root folder.
constructor --port=customOptionalPort
  1. Start coding!

Routes samples

Imagine you need an api where you'll be handling users session, and also, product prices. You may need something like this:

  {
    "users": {
      "root": "users/",
      "routes": [
        {
          "post": "login/"
        },
        {
          "post": "logout/"
        }
      ]
    },
    "products": {
      "root": "products/",
      "routes": [
        {
          "get": "get_all/"
        },
        {
          "post": "update/:productId"
        }
      ]
    }
  }

With that, express-constructor will build something like:

yourFolder
│   package.json
│   index.js
│   .gitignore
└───src
  │ │
  │ └───products
  │     │  index.js
  │     │  routes.js
  │
  └─────users
        │  index.js
        │  routes.js

And that structure will have the following urls

  /users/login
  /users/logout
  ...
  /products/get_all/
  /products/:productId/
1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago