- fork and clone this repo
npm install
- make sure postgres.app is open and running in the background
- open postico and create a new database called 'testing-db'
- in the
db.js
file be sure to change the username in the sequelize connection string to your username - run your tests by running
mocha
from the command line
- In the
user-tests.js
file, write the following five tests. Complete all five BEFORE you start creating any of the actual api routes in your server.js file. The first one is provided for you as an example:
/users
GET all users (this test is already provided for you as an example)/users/:id
GET individual user by id/users/:username
GET individual user by username/users/sort/a-z
GET users sorted a-z by username/users
POST a new user
- AFTER you've created all five tests, start adding the api endpoints in your server.js file. Add each route one at a time, and run your mocha tests after you create each individual route. You can run the tests by running
mocha
from the command line
- create a Song model in the
song-model.js
file in the models folder that has the following fields:
- artist
- title
- userId (this should be created by making an association with the User model, in order to keep track of which user submits which song)
- In the
song-tests.js
file, write the following five tests. Complete all five BEFORE you start creating any of the actual api routes in your server.js file:
/songs
GET all songs/songs/:id
GET individual song by id/songs/:title
GET individual song by title/songs/sort/z-a
GET songs sorted a-z by artist/songs
POST a new song
- AFTER you've created all five tests, start adding the api endpoints in your server.js file. Add each route one at a time, and run your mocha tests after you create each individual route. You can run the tests by running
mocha
from the command line
Add API route tests to your playlist app (or another project of your choice)