This web tool is a note-taking application that allows the user to view, save, and delete notes.
The goal of this project is to utilize the Express.js back-end framework to build API routes with Node.js and to successfully deploy the application using Heroku.
The following routes are implemented in the routes.js
file:
-
GET API route that will send all existing notes to the client:
app.get('/api/notes', (req, res) => {...});
-
POST API route that will receive a new note to save on the request body, add it to the
db.json
file, and then return the new note to the client:
app.post('/api/notes', (req, res) => {...});
-
DELETE API route that will remove the note with the requested id paramater from the
db.json
file and then return the updated array of existing notes to the client:
app.delete('/api/notes/:id', (req, res) => {})
-
HTML route that returns the
notes.html
file:
app.get('/notes', (req, res) => {...})
-
HTML route that returns the
index.html
file:
app.get('*', (req, res) => {})
There is no installation necessary. You can visit the deployed application here and try it out!
If you would like to run the application locally, use the following steps:
- Clone this repository to your local machine. (For reference, visit the Cloning a Repository GitHub Docs article.)
- Run
npm install
in your CLI to download the npm package dependencies. - Run
node server.js
on your CLI to start the server. - Open
http://localhost:3001
in your local browser.
This project requires the following npm package dependencies:
Once the user has opened the note-taker application, they will see the landing page with a button to "Get Started".
After clicking the "Get Started" button, the user will be presented with a page that shows the existing notes listed in the left-hand column, plus empty fields to enter a new note title and the note’s text in the right-hand column.
When the user enters a note title and note text, buttons to "Save Note" and "Clear Form" will appear at the top of the page. The "Clear Form" button will erase the entered title and text from the right-hand column.
After pressing the "Save Note" button, the newly created note appears in the left-hand column with the other existing notes, and the buttons in the navigation will disappear.
The user can view the other existing notes by clicking on the respective note item in the left-hand column. The image below shows the user viewing the note titled "Grocery List".
If a note is no longer needed, the user can select the red trash icon for the respective note in the left-hand column. The corresponding note will be removed from the list.
The API routes in this application were tested with the Insomnia development platform. Please refer to the Installation section if you are interested in running and testing the application locally.
The screenshot above shows the response of the GET request to the
/api/notes
endpoint.
The screenshot above shows the response of the POST request to the /api/notes
endpoint, given the request body shown below. The id for the note is generated using the generate-unique-id npm package.
{
"title": "Appointment",
"text": "Dentist appointment on 1/28 @ 1PM"
}
The screenshow above shows the response of the DELETE request to the
/api/notes/:id
endpoint, given the id paramater 0v3v
.
To make contributions to this project:
- Fork the repository
- Make some commits to improve the application
- Open a Pull Request on GitHub
- From there, we can discuss your changes and merge the pull request once your contributions have been approved!
This GitHub repository is licensed under the MIT license. Please refer to the license documentation here.
This project was created by dymoy.
For any related questions, please contact me via email at [email protected].