We'll create a new Map()
data structure to store Notes that are passed into our API in memory. With that in place we'll create a model called Note.js
that has the responsibility for saving and manipulating those notes and saving them back into our data store. After we hook up the our routes to call into our Note model and confirm that it all works.
To power our API we use some modern JavaScript syntax:
The code doesn't seems to be the same on the lesson, things like mapStore were not in the lesson, for some reason, my queries, don't seem to be accessing the model, they keep sending the same answer as in the earlier lesson.
Mortimer, I think you're right, let me make sure the code matches. Will try to get this done later today.
Also how does the code know that it must execute this exported functions, I don't see any nexus in the lesson, and my functions are not being launched when I send the queries
He didn't show how how to use the model/note.js I guess they need to be imported somewhere to work
Yeah, he didn't show how he hooked it up - if you take a look at the (github)[https://github.com/xjamundx/egghead-express/blob/master/routes/notes.js], you can see the changed lines (1, 9, 18, 26, 36, & 43).