1.2.0 • Published 4 years ago

kemboijs-cli v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

kemboijs-cli npm David

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 imrpove 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, building controllers, middlewares and also fixing issues on migrations in the near future.

How to use

  • Install: npm i -g kemboijs-cli
  • Create app: kemboijs-cli init
    • Follow the steps and select your options
  • Run app: npm start
  • Drop tables: npm run drop:db
  • Create tables: npm run create:db
  • Run tests: npm test

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

Steps:

  • Get help kemboijs-cli -- -h or kemboijs-cli help
  • Get version of app kemboijs-cli -- -v or kemboijs-cli version

Edit Database details

Navigate to src/models/setup.js, edit the database name, username or password.

You can also add these credentials to the .env file.

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

In your src/models/setup.js file:

import dotenv from "dotenv";

dotenv.config();

const dbUrl = process.env.NODE_ENV === 'test' ? process.env.TEST_DB : process.env.DATABASE_URL;
const sequelize = new Sequelize(dbUrl);

You can now call or edit the database models. The created model is User, under src/models/user.js

Folder Structure (More updates expected)

├── src                   
│   ├─ config  
|       ├─ index.js
│   ├─ controllers  
|       ├─ index.js
|       ├─ user.js
│   ├─ middlewares      
|       ├─ index.js  
|       ├─ user.js  
│   ├─ models          
|       ├─ index.js
|       ├─ user.js 
|       ├─ setup.js 
|   └─ routers 
|       ├─ index.js
|       ├─ user.js  
|   └─ scripts 
|       ├─ createdb.js
|       ├─ dropdb.js  
|       ├─ index.js  
├── test                  
│   ├─ index.js           
│   
└── index.js
└── README.md
└── package.json

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

1.2.0

4 years ago

1.1.3

4 years ago

1.1.2

5 years ago

1.1.0

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago