Store_front_Backend project

A Store online API written in NodeJS for Udacity. This application has APIs for Users, Products, and Orders.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

You need the following modules and dependencies installed to run this project:

node          # To run the server
npm              # For dependency

Installing

Simply, run the following command to install the project dependencies:

npm

Setup environment

First, create a .env file with all the required environment variables:

# .env
NODE_ENV=dev
# Sensetive database info
HOST= "127.0.0.1"
port=4000
DB_PORT=5432
db_pg=store_info
TEST_DB=store_test
USERName_DB=postgres
passward_DB=postgres
BCRYPT_PASSWORD=My-bcrypt-password255
SALT_ROUNDS=10
TOKEN=My-secretToken-esraa125

Next, start the Postgres server:

npm run start

Now, create the database

# Postgres shell
create database  store_info; 
create database  store_test;

Next, you need to run the database migrations:

db-migrate up

Running the application

Use the following command to run the application in using node:

npm run start

The application will run on http://localhost:4000/.

Running the unit tests

Use the following command to run the unit tests:

npm run test

You may also use the Postman collection present in the repository for testing.

Built With

Endpoints

Database Schema

GitHub

View Github