This Git repository stores the back-end of a news website.
The hosted API is available on: https://topstories.onrender.com/api
The RESTful API:
- Effectively handles queries from an SQL database.
- Implements a Test-Driven Development (TDD) approach and MVC architecture.
- Offers a number of endpoints for CRUD operations.
- Node.js: v20.2.0
- Express.js
- PostgreSQL (PSQL): v14.7
- node-postgres library to interface with PostgreSQL
- Git version control
-
Fork and clone
- Click Fork in the top right of the this repo page.
- Navigate to the folder you want this repo to be in locally, enter in the command line:
git clone <name-of-repo>
-
Install dependencies
- To install the dependencies enter in the command line:
npm install
- To install the dependencies enter in the command line:
-
Set-up local database
- Navigate to
package.jsonfor available scripts. - Create your own
.env.testand.env.developementfiles usingenv-exampleas a template. - Into each, add PGDATABASE=, with the correct database name for that environment (see /db/setup.sql for the database names).
- Navigate to
-
Seed the Databases
- Enter the following in the command line:
npm run setup-dbsnpm run seed -
Run Tests
- To test the functionality of the endpoints enter in the command line:
npm test