Create an application that can be used to write, save, and delete notes. This application will use an express backend and save and retrieve note data from a JSON file.
-
The following HTML routes should be created:
-
GET
/notes
- Should return thenotes.html
file. -
GET
*
- Should return theindex.html
file
-
-
The application should have a
db.json
file on the backend that will be used to store and retrieve notes using thefs
module. -
The following API routes should be created:
-
GET
/api/notes
- Should read thedb.json
file and return all saved notes as JSON. -
POST
/api/notes
- Should receive a new note to save on the request body, add it to thedb.json
file, and then return the new note to the client. -
DELETE
/api/notes/:id
- Should receive a query parameter containing the id of a note to delete. This means you'll need to find a way to give each note a uniqueid
when it's saved. In order to delete a note, you'll need to read all notes from thedb.json
file, remove the note with the givenid
property, and then rewrite the notes to thedb.json
file.
-
AS A user, I want to be able to write and save notes
I WANT to be able to delete notes I've written before
SO THAT I can organize my thoughts and keep track of tasks I need to complete
GIVEN user needs a webpage to log and delete notes
WHEN you start the server
THEN you are redirected to the homepage of the application
WHEN you click on 'Get Started'
THEN you are redirected to '/notes', the notes main page
WHEN you enter a title and text for your note and click save
THEN the note information is shown on the left of the HTML
WHEN the delete button is clicked
THEN the note is removed from the HTML and any file containing that specific note
WHEN you are redirected to 'api/notes'
THEN you will see a list of notes that have not been deleted
-
Application should allow users to create and save notes.
-
Application should allow users to view previously saved notes.
-
Application should allow users to delete previously saved notes.