To get the backend API up and running on your local machine, follow these steps:
Before proceeding, ensure you have the following installed:
Begin by cloning the repository to your local machine. Use the following command in your terminal, ensuring you navigate to your desired directory:
git clone https://github.com/michael-farah/news-api.git
Next, install the project dependencies using npm. Execute the following command in your terminal (ensure you're within the repository directory):
npm install
This command will fetch and install the required packages:
-
Dependencies:
-
Dev Dependencies:
Refer to the package.json
file for relevant scripts to set up the databases. Follow these steps:
Run the following command to initialise the databases:
npm run setup-dbs
You'll need to create two .env
files:
.env.development
.env.test
In the .env.development
file, include the following line:
PGDATABASE=your_development_database_name
In the .env.test
file, include the following line:
PGDATABASE=your_test_database_name
Replace your_development_database_name
and your_test_database_name
with the appropriate database names as specified in the /db/setup.sql
file.