This is a small sample project to help others get more familiar with developing a REST API using Node, Express and Sequelize.
This project is a work in progress.
Some files not in use, yet:
- ./config/config.js
- ./models/index.js
The files you should look at to learn:
- ./app.js -> pulls in the routers
- ./routers/ -> each router pulls in a Model
- ./models/ -> each model pulls in the sequelize instance from ./database.js
- ./database.js -> this pulls in the configuration
- ./config.js -> simple db config object
Summary:
- Clone the project
- Run
NPM Install
- Install the Sequelize CLI
- Wire up your database in ./config.js (not ./config/config.js)
- Run migrations using the Sequelize CLI
- Import 'Node API.postman_collection.json' to Postman
- Use Postman to test routes
git clone https://github.com/patrickodacre/node_api_sequelize_starter YOUR_PROJECT
cd YOUR_PROJECT
npm install
npm install -g sequelize-cli
After you config your database
sequelize db:migrate