The project includes full featured development kit to easily kickstart a new node API. It includes Docker/Mongo/Mariadb(Mysql) configuration files + a full Babel/Node.js ES6+ setup.
git clone [email protected]:hqro/Node-API-Boilterplate.git demo
cd demo
yarn install
rm -Rvf .git
git init
git remote add ...
yarn start
yarn test
yarn build
yarn production
This projet can be start directly from Docker containers. You need to install docker
and docker-compose
to try this feature.
docker network create boilerplate
docker-compose -f stack.yml up -d
It will launch a Node.js, a MongoDB and a MariaDB instance with on your local machine with a persistant volume. You can check the configuration on stack.yml
file. Don't forget to uncomment lines on index.js
.
You can now import easily from the root directory using @
symbol or with root folders names.
import '@/config/express' // import './config/express'
import demoHlpr from 'helpers/demo' // import demoHlpr from '../helpers/demo'
This is a simple starter boilerplate to avoid to configure the same things each time you start a new project.
All the important files are in the src
folder. The Express and Mongoose configuration files are in src/config
folder. Each time you want to add a new route to your Api, you can call your mongoose schema, callback you controller and make the logic from an helper.
Use de .env
file to store your important informations such as your server port, your mongo password, or maybe an OAuth key...