This repository holds my solution for the codecademy project "Quote API". It is a presentation project for implementing the basic CRUD operations in a project.
I was asked to build a small JSON API, to serve up famous quotes about computers, technology, and programming. The data (quotes) were given as an array of objects:
const quotes = [
{
quote: 'We build our computer (systems) the way we build our cities: over time, without a plan, on top of ruins.',
person: 'Ellen Ullman'
}
]
There are eight steps in total to complete the project. Seven of them are required.
- Express Routes and Express Routers lessons have to be completed in order to take this project.
- As you built the app you can use the front end to interact with the operations or Postman tool.
- Set your server to listen on the PORT.
- Your API should have a GET /api/quotes/random route. It should send back a random quote from the data
- Your API should have a GET /api/quotes route. It should return all quotes from the data.
- Your API should have a POST /api/quotes route for adding new quotes to the data.
- Finished. Great work!.
Extra Step
- Add a PUT route for updating quotes in the data.
- Add a DELETE route for deleting quotes from the data array.
I am happy that I was able to complete this porject as I am learning how Express works. It helped me to clarify few consepts regarding REST APIs and CRUD operations that I could not understand. It was fun and I believe that anyone learning Express or other frameworks should try similar projects. Experience comes with coding.
If you want to check my solution run the code below inside project folder
npm install
node express.js
Then you can go to http://localhost:4001/
to interactwith the app