This is a REST API for a news application where users can read articles, leave comments, and more.
You can access the live version of the project here: https://myas-news-api.onrender.com/api. Please note, it may take a minute to load as the server spins up on Render.
To get started with this project locally, you will need to have Node.js and PostgreSQL installed. Then, follow the instructions below.
-
Clone the repository to your local machine:
git clone [your-repo-link] cd [your-repo-folder]
-
Install all required dependencies:
npm install
To successfully run the project locally, you need to set up the necessary environment variables. These variables are stored in .env
files, follow the steps below to ensure the correct setup:
-
Create Environment Files:
- Create two
.env
files in the root of the project:.env.development
.env.test
- Create two
-
Add Environment Variables:
- Add the following variables to these files:
- For
.env.development
:PGDATABASE=nc_news
- For
.env.test
:PGDATABASE=nc_news_test
- For
- Add the following variables to these files:
Create and seed the local development database:
npm run setup-dbs
npm run seed
To ensure everything is working as expected, run the test suite:
npm test
Once the setup is complete, you can explore the API locally.