Image via Flickr under (CC BY-NC-SA 2.0)
Hello! ๐ Welcome to my news API.
This API allows users to create, read, update and delete information by interacting with the database. To view all available endpoints, please visit the hosted version using the URL below.
https://davidc-nc-news.herokuapp.com/api
Following this URL will produce a JSON file that will list all available endpoints: with available queries, example request bodies, and example responses.
For example ๐:
๐ง Before beginning setup, please check you have at least these versions of the following:
Node.js
- v. 17.5.0Postgres
- v. 14.1
After doing so, perform each step, in order:
git clone https://github.com/davidptclark/be-nc-news.git
Simply run npm install
to install the necessary dependencies required.
This repository does not contain the necessary .env files that set the value of PGDATABASE to a specific database, as they are part of the gitignore and will only be stored locally. After cloning, you will need to create two .env files in the root directory:
.env.development
.env.test
To start the API, run the command npm start
. This will instruct the API to listen on the default port: 9090.
If you would like to reinitialise the database, use the command npm run setup-dbs
followed by npm run seed
to re-seed the database.
The available endpoint have been created using Jest and pre-written tests are found in ./__tests__/
. The test files are configured to re-seed the database after each test is complete; to run these tests, as well as any you have written, use the command npm test FILENAME
.