This API is designed to store data for the Trove front end. It is currently in development so not everything is linked up but the code has been commented to show what links up and what doesn't.
Clone down this repository. You will need node
and npm
installed globally on your machine.
Installation:
npm install
To Run Test Suite:
npm test
To run the app in dev mode:
npm run dev
To run the app:
npm start
You will need to link your database and setup the port in a .env file.
In the .env file assign your database link to the following varaible:
POSTGRES_CONNECTION_URL=
The PORT is setup to default to 3005. If you wish to change this you can use the following variable in your .env file:
PORT=
There are some setup files in the db folder. Currently no setup scripts are in place, but these are planned for the future. You need to manually setup your database but the SQL queries for these are provided in the db folder.
Deployed API url: https://trove-backend.onrender.com/api
ℹ️ Please allow 10-20 seconds for the deployed backend to 'wake up', as we are using a 'hobbyist' account on our deployment site.
Method | Endpoint | Data Type | Description |
---|---|---|---|
GET | /posts | Returns all posts | |
GET | /posts?search=[tag] | string | Returns all posts with the specific tag |
POST | /posts | Creates a new post | |
DELETE | /posts/:id | number | Deletes a post |