momi-foundation-coding / nodejs-api-cli

This is a scaffold for generating new API-based application for NodeJS and its frameworks such as Express, kemboijs, koa, AdonisJs etc.
http://www.kemboijs.org/
MIT License
10 stars 13 forks source link
api express generator hacktoberfest koa nodejs nodejs-api-cli rest-api starter-kit starter-project

KemboiJs npm npm npm

nodejs-api-cli

When developing API based application in NodeJS, it is not easy to set it up as easy as possible. The application include but not limited to applications build using Express, Sails.js, kemboijs, Koa.js, hapi, AdonisJS, Nest.js etc. We decided to build this library/utility to help faster set up your API based application. In the fisrt release, We will focus on supporting Express, but will improve on other frameworks and also nodejs itself without use of frameworks. Also, we will aim at building utility that can enhance faster development of upcoming applications i.e creating controllers, services, models or middlewares. In the future, we will also help in fixing issues such as migrations and help with a little debugging.

How to use

NB: Make sure all dependancies are installed. npm install.

NB: When installing make sure you have admin priviledges otherwise, you will have to use sudo npm i -g nodejs-api-cli

Steps:

Development

NB: For production purpose testing, be sure to do build first, which generates a folder named lib/ that is ignored

NB: During development, if you need help or run an app test use the following:

To check if production works when developing: Run-

Edit Database/.env details

The app generates .env file, where you need to edit its credentials

DATABASE_URL = "postgres://user:pass@example.com:5432/dbname";
TEST_DB = "postgres://user:pass@example.com:5432/testdb";
NODE_ENV = "development";

You can now create, drop any database models. The created models is User, under src/models/user.js

Noted Items

Folder Structure (More updates expected)

├── src
│   ├─ config
|       ├─ index.js
│   ├─ controllers
|       ├─ index.js
|       ├─ user.js
|   ├─ helpers
|       ├─ index.js
|       ├─ responsehandler.js
│   ├─ middlewares
|       ├─ index.js
|       ├─ user.js
│   ├─ models
|       ├─ index.js
|       ├─ setup.js
|       ├─ user.js
|   └─ routes
|       ├─ index.js
|       ├─ user.js
|   └─ scripts
|       ├─ create-tables.js
|       ├─ drop-tables.js
|       ├─ index.js
|   └─ services
|       ├─ index.js
|       ├─ user.js
|   └─ index.js
├── tests
│     ├─ controllers
│         ├─ index.js
│         ├─ user.js
│     ├─ middlewares
│         ├─ index.js
│     ├─ routes
│         ├─ index.js
│     └─ index.js
└── .env
└── .envexample
└── .gitignore
└── package.json
└── README.md

Contributors

How To Contribute

In general, we follow the "fork-and-pull" Git workflow.

  1. Fork this repo on GitHub
  2. Clone the forked repo locally
  3. Work on your fork
    • Make your changes and additions
    • Change or add tests if needed
    • Add changes to README.md if needed
  4. Commit changes to your own branch
  5. Make sure you merge the latest from "upstream" and resolve conflicts if there is any
  6. Push your work back up to your fork
  7. Submit a Pull request so that we can review your changes

Licence

MIT