Skip to content

michael-farah/news-api

Repository files navigation

Local Backend API Setup

To get the backend API up and running on your local machine, follow these steps:

Prerequisites

Before proceeding, ensure you have the following installed:

1. Clone the Repository

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

2. Install Dependencies

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:

3. Database Setup and Seed Data

Refer to the package.json file for relevant scripts to set up the databases. Follow these steps:

a. Set Up Databases

Run the following command to initialise the databases:

npm run setup-dbs

b. Create Environment Variable Files

You'll need to create two .env files:

  • .env.development
  • .env.test

c. Add Database Configurations

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 24