In this video, learn how to connect the basket service with your route.
- [Instructor] Now, to add items to the basket…we obviously also need some overview page…that shows the items that are available in the shop.…So for that I already created plenty…of the logic in the sample project.…So let's open server, routes,…and there there's shop and index.js.…But what we have to do is, we just have…to wire in our service methods here.…First of all, we want to add the itemService,…const itemService equals require.…
And we have to go two levels up, services, and itemService.…Then, we also want to bring in the basket service,…const basketService equals require.…And again, two levels up, services, basketService.…Now, as you might remember, basketService,…let's open it again here, service,…basketService, actually exports a function…that takes the client, the redis client in.…
So we have to initiate basketService, actually, here.…So for the down here, after line seven…we add const basket equals basketService.…And we call it with config.redis.client.…Next, we have to remove…all those comments here from these routes.…
Author
Released
12/12/2017- Basics of relational and nonrelational databases
- Preparing your environment
- When to use document databases
- Inserting data into MongoDB
- Basic insert operations for MongoDB
- Querying data from MongoDB with Node.js
- Using key-value stores
- Using relational databases with Node.js
- Adding MySQL and Sequelize to a project
Skill Level Intermediate
Duration
Views
Related Courses
-
Node.js: Build Your First Microservice
with Daniel Khan2h 9m Intermediate -
Building a Website with Node.js and Express.js
with Ray Villalobos3h 16m Intermediate -
Node.js: Testing and Code Quality
with Jon Peck3h 25m Intermediate
-
Introduction
-
Welcome38s
-
Using the exercise files1m 6s
-
-
1. Get Started with Databases for Node.js
-
2. Prepare Your Environment
-
Install Node.js1m 26s
-
Install Docker1m 44s
-
Set up the sample apps9m 3s
-
-
3. Use Document Databases with Node.js
-
Set up MongoDB4m 35s
-
Connect to MongoDB3m 26s
-
Insert data into MongoDB7m 29s
-
Query data from MongoDB4m 15s
-
Introduction to Mongoose2m 59s
-
Define your first model6m 55s
-
Implement all database functions10m 17s
-
4. Use Key-Value Stores with Node.js
-
Set up Redis2m 41s
-
Use Node.js with Redis7m 55s
-
Implement a basket service10m 20s
-
Put everything together9m 28s
-
Wire up a basket page4m 16s
-
5. Use Relational Databases with Node.js
-
Set up MySQL3m 45s
-
Create a database schema4m 7s
-
Use Node.js with MySQL10m 55s
-
Introduction to Sequelize2m 24s
-
Review the database design1m 23s
-
Implement an order service8m 30s
-
Conclusion
-
Next steps37s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Put everything together