Coder Social home page Coder Social logo

store-api-typescript's Introduction

Storefront Backend Project

Project Title

A brief description of what this project does and who it's for

Pre-requisites

Run Locally

Clone the project

  https://github.com/andresaaap/store-api-typescript

Go to the project directory

  cd <project-directory>

Install dependencies

  npm install

Start the database using docker-compose

  docker-compose up -d

Make sure that you installed db-migrate globally. If not, run the following command

  npm install -g db-migrate

Run the migrations

  db-migrate up -e dev

It is possible that you need to run the command serveral times until all of the tables are created.

Build the project

  npm run build

Create a .env file in the root directory and add the following variables

POSTGRES_HOST=127.0.0.1
POSTGRES_DB=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=mypass
POSTGRES_DB_TEST=postgres_test
ENV=dev
POSTGRES_DB_PORT=5432
BCRYPT_PASSWORD=felipe-andres
SALT_ROUNDS=10
TOKEN_SECRET=secret
PORT=3000

Run project, which will start the server in port 3000 and the database in port 5432

  npm run start

Tech Stack

Server: Node, Express, jsonwebtoken, bcrypt, jasmine, jsonwebtoken, supertest

Running Tests

Start the database using docker-compose

  docker-compose up -d

Make sure that you installed db-migrate globally. If not, run the following command

  npm install -g db-migrate

Make sure that the postgres-test database doesn't exist. If it does, drop it.

  db-migrate db:drop postgres_test

Create a .env file in the root directory and add the following variables

POSTGRES_HOST=127.0.0.1
POSTGRES_DB=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=mypass
POSTGRES_DB_TEST=postgres_test
ENV=dev
POSTGRES_DB_PORT=5432
BCRYPT_PASSWORD=felipe-andres
SALT_ROUNDS=10
TOKEN_SECRET=secret
PORT=3000

To run tests, run the following command

  npm run test

Usage/Examples

The following demo shows how to use the API and run the tests

Demo ๐ŸŽฅ

store-api-typescript's People

Contributors

andresaaap 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.