Additional Intro of MP3 Jinda Han April 1, 2020 Getting Started - - PowerPoint PPT Presentation

additional intro of mp3
SMART_READER_LITE
LIVE PREVIEW

Additional Intro of MP3 Jinda Han April 1, 2020 Getting Started - - PowerPoint PPT Presentation

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/


slide-1
SLIDE 1

Additional Intro of MP3

SPRING 2020 CS 498RK Jinda Han April 1, 2020

slide-2
SLIDE 2

Getting Started

slide-3
SLIDE 3

Clone and initial the MP3

git alone https://gitlab.com/uiuc-web-programming/mp3.git mp3 cd mp3 npm install

slide-4
SLIDE 4

Run MP3

npm start http://localhost:4000/api/ Environment good 👎

slide-5
SLIDE 5

Postman

A useful Dev tool: “The Collaboration Platform for API Development”

slide-6
SLIDE 6

Download Postman

  • https:/

/www.postman.com/

slide-7
SLIDE 7

Run Postman

Check API: localhost:4000/api/ Return like this (nothing) because you haven’t implemented your mp!

slide-8
SLIDE 8

mongoDB Atlas

slide-9
SLIDE 9

Register

  • https:/

/www.mongodb.com/cloud/atlas

slide-10
SLIDE 10

Build a New Cluster

slide-11
SLIDE 11
slide-12
SLIDE 12

Wait for a while!

slide-13
SLIDE 13

Connect

slide-14
SLIDE 14

mongodb+srv://test_d4:<password>@cs498rkmp3-jxf1h.mongodb.net/test?retryWrites=true&w=majority What is the password? Username Password

slide-15
SLIDE 15

User and Password

mongodb+srv://test_d4:<password>@cs498rkmp3-jxf1h.mongodb.net/test?retryWrites=true&w=majority

slide-16
SLIDE 16

Connect the Project

Type your Username, Password, and URL, not mine. mongodb+srv://test_d4:<password>@cs498rkmp3-jxf1h.mongodb.net/test?retryWrites=true&w=majority

slide-17
SLIDE 17

Before Running anything…

slide-18
SLIDE 18

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.

slide-19
SLIDE 19

Create the endpoints

This is an example, implementation may vary Simple Example, not full code You need to implement POST/ GET/PUT/DELETE

slide-20
SLIDE 20

Complete Mongoose Schema

Complete the Schema for User and Task This is an example, implementation may vary

slide-21
SLIDE 21

After you finish

slide-22
SLIDE 22

Fill Database: dbFill.py

python3 dbFill.py -u "localhost" -p 4000 -n 20 -t 100 cd mp3/database_scripts/

slide-23
SLIDE 23

Clean the Database

python3 dbClean.py -u "localhost" -p 4000 cd mp3/database_scripts/

slide-24
SLIDE 24

Testing MP3

slide-25
SLIDE 25

Query Example

slide-26
SLIDE 26

Example Returns full list of tasks

localhost:4000/api/tasks

slide-27
SLIDE 27

Return a list of completed Tasks

http://localhost:4000/api/tasks?where={"completed": true}

slide-28
SLIDE 28

Returns tasks number from 61 to 80

http://localhost:4000/api/tasks?skip=60&limit=20

slide-29
SLIDE 29

Tips

slide-30
SLIDE 30

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

slide-31
SLIDE 31

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

slide-32
SLIDE 32

Thanks!

slide-33
SLIDE 33

Reference

  • Images: https://images.google.com/
  • Questions Insight: https://piazza.com/ CS498rk SP19 and SP20