This is the back-end project I completed as part of my Northcoders bootcamp. It serves as the backend API for a Reddit-style web application, and allows users to interact with the application by performing CRUD operations on articles and comments as well as voting on comments.
It was built using Node.js and Express.js and uses PostgreSQL as its database. This API will serve as the backend API for a future frontend project to be built using React.js.
You can check out a live version of this app here, hosted using Render. All endpoints are viewable here.
- Node.js
- Express.js
- PostgreSQL
- Supertest
- Jest
- Node.js: v20.4.0
- PostgreSQL: v14.9
- Clone this repository
$ git clone https://github.com/vh232/NC-be-project.git
- Run
npm install
to install dependencies listed in thepackage.json
- Create two .env files:
$ touch .env.development
$ touch .env.test
- Insert the following into each file.
.env.development:
PGDATABASE=nc_news
.env.test:
PGDATABASE=nc_news_test
You can refer to .env.example
for a template
- Run
npm run setup-dbs
to set up PostgreSQL database - Run
npm run seed
to populate databases.
Run npm test
to execute tests using Supertest and Jest. To start the local server run npm run dev
.