Coder Social home page Coder Social logo

e-store-api's Introduction

A basic e-store-API for the e-commerce platform

api is used in this site PcMart

this is api for e-store
you can create , update , delete and get all for products , categories and carts
using auth token from firebase,
no need to create user database in this project
firebase is handling user auth for us


Endpoints


How to start

  • download and install node.js

  • download and install PostgreSql

  • run the following command to install the dependencies:

        npm install
    

    you are now ready to go.


Database

  • after downloading PostgreSql and install it

  • run the following command to connect to postgres:

        psql -U postgres
    

    to login to the database and write your password you created in the installation.

  • after login to the database, write the following command to create the database:

        CREATE DATABASE store_dev;
        CREATE DATABASE store_test;

Environment variables

  • put inside the .env file
    PORT=3000 #or any other port
    NODE_ENV=dev #{dev, test, production}
    DB_HOST=localhost
    DB_PORT=5432
    DB_USER='...' # your postgres username
    DB_PASSWORD='...' # your postgres password
    DB_NAME=store_dev 
    DB_TEST=store_test 
    DATABASE_URL='...' # connection string for ssl connection, production phase for heroku

Scripts

  • To run the server

        npm run start
    
  • To run the server in development mode with nodemon

        npm run dev
    
  • To run db-migrate up to start the migration

        npm run migrate:up
    
  • To run db-migrate down to rollback the migration

        npm run migrate:down
    
  • To run prettier to format the code

        npm run prettier
    
  • To run eslint to check the code

        npm run eslint
    
  • To clean the code with prettier and eslint

        npm run format
    

Directory structure

root:.
    ├───migrations
    │   └───sqls
    ├───spec
    │   └───support
    └───src
        ├───database
        ├───handlers
        ├───helpers
        ├───middleware
        ├───models
        └───routes
            └───APIs

e-store-api's People

Contributors

abdelrahman-tarek-0 avatar

Stargazers

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