Doing stuff! This is a review of backend technology for the upcoming checkpoint.
- Fork and clone this repo
- cd into the repo
npm install
- Create a database called
dog-time
on your machine by runningcreatedb dog-time
in your command line (it doesn't matter what directory you're in when you run this) - I've created a seed file that populates your database with dummy data so that you don't have to make a million post requests in order to have data. DO NOT WORRY AT ALL about how to make a seed file right now. In order to populate your database with this seed file, run
node scripts/seed.js
to seed your database. Only do this after you've created your db in step 4. Until you do this, you won't have any data to work with. - Look at your new database in Postico and see what data you have
- Start the application with:
npm start
- Start looking at routes! Remember that all routes that serve up data in this project are prepended with
localhost:3000/api
, i.e. the full all dogs route islocalhost:3000/api/dogs/
- Use your browser to test out get routes and use Postman to test out put, post, and delete routes. Play around with the different ways you can add data with the existing setup, for example:
- You can pass in an ownerId when you create a dog and an association will be made automatically (as long as an owner with that id exists in the database)
- You can also post a dog with a dogYearsAge property and it will automatically create an age field based on the virtual setter we have
- Aaaand you can create a dog without specifying a breed and your dog will be assigned the breed 'mutt' by default