Command line interface to start a new nodejs API based on express framework with Ornito structure defined from past projects.
- async await functions
- email builder using sendgrid service
- jobs using cronjob
- resources creation from command line
- relational and non-relational databases
- eslint
- tests
- convention over configuration
- knex.js
Ornito JS
allow you to easily start an API and code oriented to modules. strives to be an easily embeddable and beautiful command line interface for Node.js.
Ornito JS
needs the following tools/techonologies to be able to start up.
- Nodemon
- Nodejs > 7.6.0
- Postgres
- Mongodb (if you're going to use it)
- Redis (if you're going to use it)
Note:
Ornito CLI
is still in active development, we want to deliver more features like eslint, iugu integration and more.
npm install -g ornitojs
ornito start
npm start
npm test
npm run linter
ornito module user
➡️ ./knexfile.js
development: {
client: 'postgresql',
connection: {
database: 'yourdb',
user: 'youruser',
password: 'yourpassword'
},
pool: {
min: 2,
max: 10
},
migrations: {
tableName: 'migrations'
},
seeds: {
directory: './seeds/dev/'
}
},
➡️ ./src/config/ENV.json
{
"db_host": "postgres://youruser:yourpassword@localhost:5432/yourdb",
"sendgrid_api_key": "",
"iugu": {
"url": "https://api.iugu.com/v1/",
"api_key": "",
"api_token": ""
},
"cloudinary": {
"cloud_name": "",
"api_key": "",
"api_secret": "",
"env_variable": ""
}
}
- user
- tests
- user.spec.js
- user.model.js
- user.persistence.js
- user.service.js
- tests
- tests: We are using Jest to test our models, but you can test endpoints, services and schema validations in this folder. The test suit is called from
npm test
- model: Our entities represented by javascript classes. We're using Joi to validate our models, so when we receive a request, if the payload validation is not correct, we throw an error.
- persistence: Here you're able to require your database driver and start querying and inserting data to your choosen database.
- service: We can validate params, integrate with 3rd part services, create rules, call our models, etc.
- create database if does not exist (node-postgres)
- show eslint options (standard, standard2, airbnb...)
- create job from CLI
- option to inform database settings while creating structure (user, password, host)
- implicit filters on routes
- unify postgres database config
- error handler
- create mongodb module