Kamahl19 / node-api-starter

Full-featured starter for Node Rest API server using ExpressJS
MIT License
6 stars 0 forks source link

Node API Starter

What’s Inside?

Getting Started

This project uses dotenv for setting environmental variables during development. Simply copy the .env.example file, rename it to .env and add your env variables as you see fit. There is also a src/config.js file with several configuration options.

Install, Seed DB & Start the server

npm install
npm run seed
npm start

The server will start at http://localhost:3001

Deployment to Heroku

heroku login
heroku create my-app
git init
heroku git:remote -a my-app
git add .
git commit -am "initial commit"
git push heroku master

Project structure

-| src/
 |--| app/: Main application (framework) files.
 |--| common/: Reusable common files such as messages, validation rules, services, utils etc.
 |--| features/: Features bundled into separate modules
 |--| seeds/: DB seed files
 |--| config.js: Global application config file
 |--| index.js: Application entry file

Prettier

This project uses Prettier, an opinionated code formatter. In order to format code manually, run npm run format in app root directory. All the code is also formatted automatically on pre-commit hook. There is also npm run format-check for CI purposes to check if code is formatted properly.

ESLint

Project comes with ESLint configured. It helps you prevent common errors.

There are multiple ways how to run ESLint.

Updating dependencies

Project comes with the default Renovate config renovate.json. It takes care of automated dependency updates and it's free for open-source projects. More about how to configure here.