This API is part of the project set out by futureproof for Lap 1 of the 13-week bootcamp. The task was to design and develop a journaling-style website using full-stack. We have chosen our project to be a storyboard messaging webapp for school children whereby they can create stories which are displayed. This repository deals with the back-end of the project.
We have used NodeJS and Express to build this API. The code has been laid out using an MVC architecture. This API has several endpoints which respond with getting and posting stories and their replies.
A minimum of Node v16.11.0 needs to be installed
After git cloning this repository, CD into the directory lap-1-project-server-side
and run the following command to install all the dependencies:
$ npm i
After the dependencies are installed, the API is ready to be ran
To start the API, run the following script:
$ npm run dev
From here a GET and POST requests can be made by using the local host with base URL: http://localhost:3000/ in insomnia or in a web browser.
For testing, Jest has been implemented. To run the test, execute the following command:
$ npm t
The API is hosted on Heroku. This URL can be used as the base URL. Previews of the what requests and responses look like are avaialbe here.
These are the requests that can be made to the API:
GET:
- /all - gets all messages
- /:id - gets messages by their Id's
- /:id/replies - gets all replies to messages by the message ID
POST:
- /post - posts body from client onto the database
- /:id/replies - posts reply body onto database corresponding to message ID
Add these endpoints to the base URL to make a request
For heroku, the 'start' script seems to be linked to heroku, hence it should only contain the node command, not others such as nodemon.
Team Surviving With Google: