Node.js, Express, Nunjucks, MongoDB, and Mongoose There are a couple of programs similar to this assignment given in the lecture notes for the week that discusses CRUD operations. Specifically, the Admin example and the CIT300 example both have index.js code and nunjucks code similar to this assignment. You may find some of the other example programs useful as well. It would ultimately save you time if you have already studied these programs before giving this assignment a shot. Either way, hopefully you'll start early and you've kept to the schedule in terms of reading the lecture notes. You will need to create a database named travel using compass, then create a collection named trips. Use these names; your code must work with my database. The trips documents should then be imported unto the trips collection by importing the JSON file containing all the data as linked below. The file itself is named trips.json, and is available on the course website in the same folder as this assignment. You will need to unzip it before importing it into compass. The following video discusses how to get the data and offers an overview of how all this should work. I recommend looking at this video before anything else. click YouTube here Video Html forms Program 5 hint video You don't necessarily need to import any data. The add trip data option in your program will allow you to add new data one record (document) at a time. But know how to add a backup file to your database is a good thing to know. The database in the example has 38-ish records, and the first two look like the following after being imported into Compass. Note miles per gallon is not a field in the schema, but will be calculated from the miles property divided by the gallons property, calculated as a virtual field. The date, which is stored as a string data type, has a specific format: yyyy-mm-dd. So for February 6th, 2017 it would be 2017-02-06. ADD DATA ▾ VIEW () _id: ObjectId("5bd7335b802c8e1cd8aa7b29") driver: "andy" date: "2017-02-06" city: "chicago" miles: 700 gallons: 27 _id: ObjectId("5bd7335b802c8e1cd8aa7b2b") driver: "barb" date: "2017-03-14" city: "nashville" miles: 399 gallons: 14.1 The date property should be unique and of type String, not type Date. Program Interface Program Interface Here is my default page with my data. We are restricted to only taking trips to four cities: chicago, cincinnati, indianapolis, and nashville. Any drop-down lists you use need to contain these cities only as options. As noted, Miles per Gallon is not a field in the schema, but is calculated from Miles divided by Gallons using a virtual field. Be sure to include a column for the driver, which is accidentally omitted in this image. Note we have a link in each row allowing editing trip data. → C localhost:3000 Our Website Home Add Trip Data Get by City * All Trip Data include a column for the driver too Date City Miles Gallons Miles per Gallon edit 2017-02-06 chicago 690 26.9 25.7 Edit 2017-03-01 cincinnati 220 7.9 27.8 Edit 2017-03-14 nashville. 399 14.1 28.3 Edit 2017-04-04 nashville 377 11.4 33.1 Edit 2017-04-14 chicago 672 22 30.5 Edit 2017-05-07 indianapolis 254 8.8 28.9 Edit If you click the Edit link on any of the rows above, it makes a GET request to a route that retrieves the document using the date to select the document. The trick is to have the Edit link contain the info to make the GET request when the page above loads. Something like this as the last row of the template for the above should work, where the date value in the template is the date that was displayed for that row... Edit The GET request is made to a route that queries the db and populates and display a template that looks like the following. Initially the textboxes for the miles and gallons are hidden. Clicking the Edit button displays the textbox. In the example shown, the Edit button for miles has been clicked, but the Edit button for Gallons has not. Note the textbox is populated with the correct miles value when it is first displayed. Then user can then change that value as needed. There are examples of how this is done in the program examples upon which this assignment is based. Our Website Home Add Trip Data Get by City Trip Date: 2017-02-06 City chicago- Miles 690 Edit 690 Enter new value Gallons26.9 Edit Submit

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Node.js, Express, Nunjucks, MongoDB, and Mongoose
There are a couple of programs similar to this assignment given in the lecture
notes for the week that discusses CRUD operations. Specifically, the Admin
example and the CIT300 example both have index.js code and nunjucks code
similar to this assignment. You may find some of the other example programs
useful as well. It would ultimately save you time if you have already studied
these programs before giving this assignment a shot. Either way, hopefully
you'll start early and you've kept to the schedule in terms of reading the lecture
notes.
You will need to create a database named travel using compass, then create a
collection named trips. Use these names; your code must work with my
database. The trips documents should then be imported unto the trips collection
by importing the JSON file containing all the data as linked below. The file itself
is named trips.json, and is available on the course website in the same folder as
this assignment. You will need to unzip it before importing it into compass.
The following video discusses how to get the data and offers an overview of how
all this should work. I recommend looking at this video before anything else.
click YouTube
here Video
Html forms
Program 5 hint video
You don't necessarily need to import any data. The add trip data option in your
program will allow you to add new data one record (document) at a time. But
know how to add a backup file to your database is a good thing to know.
The database in the example has 38-ish records, and the first two look like the
following after being imported into Compass. Note miles per gallon is not a field
in the schema, but will be calculated from the miles property divided by the
gallons property, calculated as a virtual field. The date, which is stored as a
string data type, has a specific format: yyyy-mm-dd. So for February 6th, 2017
it would be 2017-02-06.
ADD DATA ▾
VIEW
()
_id: ObjectId("5bd7335b802c8e1cd8aa7b29")
driver: "andy"
date: "2017-02-06"
city: "chicago"
miles: 700
gallons: 27
_id: ObjectId("5bd7335b802c8e1cd8aa7b2b")
driver: "barb"
date: "2017-03-14"
city: "nashville"
miles: 399
gallons: 14.1
The date property should be unique and of type String, not type Date.
Program Interface
Transcribed Image Text:Node.js, Express, Nunjucks, MongoDB, and Mongoose There are a couple of programs similar to this assignment given in the lecture notes for the week that discusses CRUD operations. Specifically, the Admin example and the CIT300 example both have index.js code and nunjucks code similar to this assignment. You may find some of the other example programs useful as well. It would ultimately save you time if you have already studied these programs before giving this assignment a shot. Either way, hopefully you'll start early and you've kept to the schedule in terms of reading the lecture notes. You will need to create a database named travel using compass, then create a collection named trips. Use these names; your code must work with my database. The trips documents should then be imported unto the trips collection by importing the JSON file containing all the data as linked below. The file itself is named trips.json, and is available on the course website in the same folder as this assignment. You will need to unzip it before importing it into compass. The following video discusses how to get the data and offers an overview of how all this should work. I recommend looking at this video before anything else. click YouTube here Video Html forms Program 5 hint video You don't necessarily need to import any data. The add trip data option in your program will allow you to add new data one record (document) at a time. But know how to add a backup file to your database is a good thing to know. The database in the example has 38-ish records, and the first two look like the following after being imported into Compass. Note miles per gallon is not a field in the schema, but will be calculated from the miles property divided by the gallons property, calculated as a virtual field. The date, which is stored as a string data type, has a specific format: yyyy-mm-dd. So for February 6th, 2017 it would be 2017-02-06. ADD DATA ▾ VIEW () _id: ObjectId("5bd7335b802c8e1cd8aa7b29") driver: "andy" date: "2017-02-06" city: "chicago" miles: 700 gallons: 27 _id: ObjectId("5bd7335b802c8e1cd8aa7b2b") driver: "barb" date: "2017-03-14" city: "nashville" miles: 399 gallons: 14.1 The date property should be unique and of type String, not type Date. Program Interface
Program Interface
Here is my default page with my data. We are restricted to only taking trips to
four cities: chicago, cincinnati, indianapolis, and nashville. Any drop-down lists
you use need to contain these cities only as options. As noted, Miles per Gallon
is not a field in the schema, but is calculated from Miles divided by Gallons
using a virtual field. Be sure to include a column for the driver, which is
accidentally omitted in this image. Note we have a link in each row allowing
editing trip data.
→ C
localhost:3000
Our Website
Home
Add Trip Data
Get by City
*
All Trip Data
include a column for the driver too
Date
City
Miles
Gallons
Miles per Gallon
edit
2017-02-06
chicago
690
26.9
25.7
Edit
2017-03-01
cincinnati
220
7.9
27.8
Edit
2017-03-14
nashville.
399
14.1
28.3
Edit
2017-04-04
nashville
377
11.4
33.1
Edit
2017-04-14
chicago
672
22
30.5
Edit
2017-05-07
indianapolis
254
8.8
28.9
Edit
If you click the Edit link on any of the rows above, it makes a GET request to a
route that retrieves the document using the date to select the document. The
trick is to have the Edit link contain the info to make the GET request when the
page above loads. Something like this as the last row of the template for the
above should work, where the date value in the template is the date that was
displayed for that row...
<td>
<a href='/editTrip?tripDate={{variableName.date}}'>Edit</a>
</td>
The GET request is made to a route that queries the db and populates and
display a template that looks like the following. Initially the textboxes for the
miles and gallons are hidden. Clicking the Edit button displays the textbox. In
the example shown, the Edit button for miles has been clicked, but the Edit
button for Gallons has not. Note the textbox is populated with the correct miles
value when it is first displayed. Then user can then change that value as
needed. There are examples of how this is done in the program examples upon
which this assignment is based.
Our Website Home
Add Trip Data
Get by City
Trip Date: 2017-02-06
City
chicago-
Miles 690
Edit 690
Enter new value
Gallons26.9 Edit
Submit
Transcribed Image Text:Program Interface Here is my default page with my data. We are restricted to only taking trips to four cities: chicago, cincinnati, indianapolis, and nashville. Any drop-down lists you use need to contain these cities only as options. As noted, Miles per Gallon is not a field in the schema, but is calculated from Miles divided by Gallons using a virtual field. Be sure to include a column for the driver, which is accidentally omitted in this image. Note we have a link in each row allowing editing trip data. → C localhost:3000 Our Website Home Add Trip Data Get by City * All Trip Data include a column for the driver too Date City Miles Gallons Miles per Gallon edit 2017-02-06 chicago 690 26.9 25.7 Edit 2017-03-01 cincinnati 220 7.9 27.8 Edit 2017-03-14 nashville. 399 14.1 28.3 Edit 2017-04-04 nashville 377 11.4 33.1 Edit 2017-04-14 chicago 672 22 30.5 Edit 2017-05-07 indianapolis 254 8.8 28.9 Edit If you click the Edit link on any of the rows above, it makes a GET request to a route that retrieves the document using the date to select the document. The trick is to have the Edit link contain the info to make the GET request when the page above loads. Something like this as the last row of the template for the above should work, where the date value in the template is the date that was displayed for that row... <td> <a href='/editTrip?tripDate={{variableName.date}}'>Edit</a> </td> The GET request is made to a route that queries the db and populates and display a template that looks like the following. Initially the textboxes for the miles and gallons are hidden. Clicking the Edit button displays the textbox. In the example shown, the Edit button for miles has been clicked, but the Edit button for Gallons has not. Note the textbox is populated with the correct miles value when it is first displayed. Then user can then change that value as needed. There are examples of how this is done in the program examples upon which this assignment is based. Our Website Home Add Trip Data Get by City Trip Date: 2017-02-06 City chicago- Miles 690 Edit 690 Enter new value Gallons26.9 Edit Submit
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY