Skip to content

notes-app is a RESTful app created using the MERN stack. It allows you to create your own DB and server and manipulate it with the client-side minimalistic app. The server allows you to CRUD notes, and track changes in the history.

Notifications You must be signed in to change notification settings

Monsy99/notes-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Setup

1.Make sure you have node.js installed

  • 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

2. In order to run the project you need to have a local mongoDB

  • 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

3.Open a terminal in the "server" directory of the downloaded project and run following commands

  • 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

4.Open a terminal in the client directory and run following commands

  • Install packages

npm install

  • Start the client side

npm start

5. Usage

The "client" interface represents all features of the created API


Usage

Pathnames to CRUD notes with a curl

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
  1. 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
  1. 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
  1. 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
  1. 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

About

notes-app is a RESTful app created using the MERN stack. It allows you to create your own DB and server and manipulate it with the client-side minimalistic app. The server allows you to CRUD notes, and track changes in the history.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published