The Northcoders News API provides backend functionality for a news or blog application, enabling data interactions between a frontend client and a PostgreSQL database. It supports operations on news articles, comments, and user data.
Before you begin, ensure you have the following installed:
- Node.js (v14 or newer)
- npm (v6 or newer)
- PostgreSQL
Start by cloning the repository to your local machine:
git clone https://github.com/ProdiGeeZ/be-nc-news.git
cd be-nc-news
Install the necessary Node.js packages:
npm install
- Create a
.env.development
file in the root directory. - Add the following line to specify the development database:
PGDATABASE=nc_news
- Create a
.env.test
file in the root directory. - Add the following line to specify the testing database:
PGDATABASE=nc_news_test
Initialize the database and seed it with initial data:
npm run setup-db
To start the server in development mode:
npm run dev
This will start the server on http://localhost:9090
by default.
To run automated tests:
npm test
For more details on API endpoints and usage, refer to the API documentation provided in the docs
directory.