Giter VIP home page Giter VIP logo

e-store_backend_api's Introduction

e-store Backend API

The main functions of this project are:

1: To provide a reliable storefornt API based on node and Postgres DB
2: The API main endpoints are /products /orders and /users Each endpoint will have different behaviours depending on the verb applied to them as indicated in the Endpoint section of the requirements file requirements

Links

Database users and setup:

Create user

psql-sh: CREATE USER storefront_admin WITH PASSWORD password123

Create database via SQL query CREATE DATABASE storefront CREATE DATABASE test_storefront

grant privlieges to user on both databases GRANT ALL PRIVILEGES ON DATABASE storefront TO storefront_admin GRANT ALL PRIVILEGES ON DATABASE test_storefront TO storefront_admin

Available Commands

In the project directory, you can run:

`db-start"

This command will run 'db-migrate db:up storefront' this will initialize the developement database with the tables mentioned in the requirements database schema.

`db-test-start"

This command will run 'db-migrate db:up test_storefront' this will initialize the test database with the tables mentioned in the requirements database schema.

`npm run start"

The command will run 'node dist/server.js which will start the express app on localhost:3000. Open http://localhost:3000/ and append the endpoints mentioned above. for instance http://localhost:3000/products (indexes all products). However in order to test to its fullest it is recommended the usage of an app such as postman in order to easily test different http requests (GET,POST,DELETE etc)

`"npm run build"

Builds the app for production to the dist folder. It correctly transpiles all the dev code in .ts to working javascript files

`"npm run test"

  • This firstly launches a test database migration (test_storefront) and creates all the necessary tables for the API to function in a testing environment.
  • After that the test will run build in order to transpile the typescript in case it hadn't been done before.
  • Once the build is completed the test will launch jasmine, which will test the endpoints for each model.
  • Finally when all the tests are complete a down migration will be executed in order to clean the database and always have a clean slate to run the tests

`"npm run nodemon"

For running the developement version of the app

Built With

  • TypeScript
  • Express
  • Node
  • Jasmine
  • NPM
  • PostgreSQL
  • JWT (json web tokens for authenitcation)

Future Updates

  • Include further endpoints implementations
  • Work on a potential front end with a framework

Author

Jordi Riera

e-store_backend_api's People

Contributors

jriera avatar christa-cheung avatar berkeleycole 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.