-
You can download it here
-
To make sure everything is working run
npm -v
- You should get a message with information about your npm version
-
You can download it here
-
Create a directory for default mongo data path "C:\data\db"
-
Open a cmd in the bin directory of the installed folder. It might be under "C:\mongodb" or "C:\Program Files\MongoDB\Server\X.X\bin" (Windows)
-
Run:
mongod.exe
In the pathname argument you can specify a folder to save the db files but it's not necessary
-
In order for the app to work correctly don't change the default port on which the mongod is running
-
Keep the mongod terminal open for the rest of the time while running the project
- Install packages with
npm install
- To test if the server is working with the database run
npm test
- If the tests are passed terminate current process and run: (26.01 update - the tests are now being run in a in-memory db, no issues found)
node index.js
- If there is a "connected to database url" message then we are ready to CRUD the notes
- Install packages
npm install
- Start the client side
npm start
Server url by default should run on port 3000
localhost:3000
Note list | Note | Deleted notes | Note history |
---|---|---|---|
/api/notes |
/api/note/:id |
/api/deleted |
/history/:id |
-
get method (read a note/read notes) returns an object with "success" property in response body
-
Returns "success" property that tells us whether we recieved the data
-
If request was fulfilled then under "data" property we get requested object/list
-
If request failed or there is no data, response body "error" property has a message
-
history/:id
path returns a complete note with additional "history" field that tracks any content changes
-
Create a note |
---|
/api/notes |
-
post method (create a note) requires object with "title" and "content"
-
Returns "success" property that tells us whether the note was created
-
Returns "_id" property
-
Delete a note |
---|
/api/note/:id |
-
delete method (delete a note)
-
Returns "success" property that tells us whether the note was deleted
-
Returns "_id" property in case you want to see a
history
-
Update a note |
---|
/api/note/:id |
-
put method (update a note) requires a body with "content", "title" is optional
-
Returns "success" property that tells us whether the note was updated
-
Returns "_id" property
-