CS 498RK SPRING 2020 Additional Intro of MP3 Jinda Han April 1, 2020
Getting Started
Clone and initial the MP3 git alone https://gitlab.com/uiuc-web-programming/mp3.git mp3 cd mp3 npm install
Run MP3 npm start http://localhost:4000/api/ Environment good 👎
Postman A useful Dev tool: “The Collaboration Platform for API Development”
Download Postman • https:/ /www.postman.com/
Run Postman Check API : localhost:4000/api/ Return like this (nothing) because you haven’t implemented your mp!
mongoDB Atlas
Register • https:/ /www.mongodb.com/cloud/atlas
Build a New Cluster
Wait for a while!
Connect
Username Password mongodb+srv:// test_d4 :< password >@cs498rkmp3-jxf1h.mongodb.net/test?retryWrites=true&w=majority What is the password?
User and Password mongodb+srv:// test_d4 :< password >@cs498rkmp3-jxf1h.mongodb.net/test?retryWrites=true&w=majority
Connect the Project mongodb+srv:// test_d4 :< password >@cs498rkmp3-jxf1h.mongodb.net/test?retryWrites=true&w=majority Type your Username , Password , and URL , not mine.
Before Running anything…
Task Implement an API with the following required endpoints (they would be preceded by something like http:/ /localhost:4000/api/*). Your implementation should use Node, Express and Mongoose.
Create the endpoints Simple Example, not full code You need to implement POST/ GET/PUT/DELETE This is an example, implementation may vary
Complete Mongoose Schema Complete the Schema for User and Task This is an example, implementation may vary
After you finish
Fill Database: dbFill.py cd mp3/database_scripts/ python3 dbFill.py -u "localhost" -p 4000 -n 20 -t 100
Clean the Database cd mp3/database_scripts/ python3 dbClean.py -u "localhost" -p 4000
Testing MP3
Query Example
Example Returns full list of tasks localhost:4000/api/tasks
Return a list of completed Tasks http://localhost:4000/api/tasks?where={"completed": true}
Returns tasks number from 61 to 80 http://localhost:4000/api/tasks?skip=60&limit=20
Tips
Basic Test Cases (70% total grade) • Retrieve the list of users • Insert a new user • Retrieve a valid user • Update a valid user • Retrieve a valid user with parameters • Retrieve user count • Delete a valid user • Retrieve an invalid user • Delete an invalid user • Retrieve the list of tasks • Insert a new task • Retrieve a valid task • Update a valid task • Retrieve a valid task with parameters • Retrieve task count • Delete a valid task • Retrieve an invalid task • Delete an invalid task (Invalid user = nonexistent user) Extra test corner cases worth 30% points, will not release
Additional Resources • Express Tutorial Using Database with Mongoose • https:/ /developer.mozilla.org/en-US/docs/Learn/Server-side/ Express_Nodejs/mongoose • Express Basic Routing • https:/ /expressjs.com/en/starter/basic-routing.html • Mongoose API Docs • https:/ /mongoosejs.com/docs/api • MongoDB Docs • https:/ /docs.mongodb.com/manual/tutorial/query-documents/ • https:/ /docs.mongodb.com/manual/reference/database- references/ • HTTP Status Code • https:/ /www.restapitutorial.com/httpstatuscodes.html
Thanks!
Reference • Images: https://images.google.com/ • Questions Insight: https://piazza.com/ CS498rk SP19 and SP20
Recommend
More recommend