GithubHelp home page GithubHelp logo

storefront-backend's Introduction

Udacity StoreFront Backend

This is the backend for the Udacity StoreFront application.

The database schema and the api endpoints are described in the REQUERMENTS.md file.

Running instructions

Installing dependencies

To run the backend, you will need to install the dependencies:

to install dependencies:

yarn 

setting up the database

this project uses postgres database on docker container that runs on port 5432.

  • To run database in the docker container:
docker-compose -f docker-compose.yml up
  • connect to the database:
psql -h 127.0.0.1 postgres
  • create the Project database:
CREATE DATABASE store_front;
  • create Testing database:
CREATE DATABASE store_front_test;
  • to make the database looks like the schema in the migration file:
yarn global add db-migrate
db-migrate up

Setting up env variables

you must make an .env file in the root of the project providing the following information.

POSTGRES_HOST=127.0.0.1
POSTGRES_DB=store_front
POSTGRES_TEST_DB=store_front_test
POSTGRES_USER=testuser
POSTGRES_PASSWORD=testpassword
BCRYPT_PASSWORD=testPassword
SALT_ROUNDS=10
JWT_SECRET=testPassword
ROOT_USERNAME=root
ROOT_PASSWORD=root
ENV=dev

Statring the backend

to run the backend:

yarn watch

Running ports

The server will start on port 3000.

EndPoints

all endpoints are described in the REQUIREMENTS.md file.

Authentication

tokens are generated using the JWT library.

to provide authentication to the backend you must path the token to the header of the request as:

{
"Authorization": "Bearer <token>"
}

and to get your token you must use the login endpoint as described in the REQUIREMENTS.md file.

Testing instructions

to test the backend:

yarn test

storefront-backend's People

Contributors

mrgafs avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.