This project is a demonstration of a RESTful API written in JavaScript and using Express JS alongside PostgreSQL as a database.
This API is used as the Back End of my Front End project: https://github.com/jjcrl/fe-nc-news
-
GET All available endpoints
-
GET An article by its id
-
GET All articles , with the abilitly to filter by topic, and sort by various feilds and decide the order
-
GET All users
-
GET A single user
-
GET All Topics
-
GET Comments for a given article
-
POST Publish a new article
-
POST Comment on an article
-
POST Create a new topic
-
PATCH Vote on a comment
-
PATCH Vote on an article
-
DELETE Your own article
-
DELETE Your own comment
- Node.js (v16.13.1)
- PostgreSQL (v2.5.2)
'git clone https://github.com/jjcrl/be-nc-news.git'
Install JS dependencies by running 'npm i'
within the cloned repository
You must also have PostgreSQL installed and running for following steps to succeed
Create '.env.test'
and '.env.development'
files containing 'PGDATABASE=nc_news_test'
and 'PGDATABASE=nc_news'
respectively, in the root directory of this repository
- Run
'npm run setup-dbs'
to create the databases in PostgreSQL - Run
'npm run seed'
to seed the created databases
At this stage, you're able to run tests with 'npm run test'
You can also test the API manually by running 'npm run start'
and making requests to localhost:[port] to whichever endpoints you wish to test