This app is meant to give students experience with building REST APIs with Node, Express, JWT-based auth, Mongo, and Mongoose.
It is also provided as a backend that curriculum contributors, instructors, and students can run locally to build clients that provide a GUI for this API.
- Clone the repo.
cd
into it.npm install
- Make sure you have Mongo installed and running locally.
- Rename the
.env.example
file to.env
. This file sets up any config vars that you'll need to run this app locally. - Run
node util/seed-database.js
- The seed process inserts three users:
user0
,user1
, anduser2
with the passwordpassword
. - Run
npm start
to start the dev server. - To access a protected endpoint
- POST the username + password to
/api/login
- Copy the authToken value
- Add token
Authorization
header as a Bearer Token
- POST the username + password to
If you need to zero out the database, you can run node util/drop-database.js