Giter VIP home page Giter VIP logo

food-ordering-app's Introduction

Food ordering app

App

Server

Folder structure

.
├── controllers                             # Controllers/ Routes for each entity
├── db
│   ├── config
│   │   └── config.js                       # Migration config file
│   ├── config.ts                           # Database configurations
│   ├── migrations                          # Migration files
│   └── seeders                             # Seeder files
├── env.sample                              # Sample environment variables
├── express                                 # Express configurations
├── index.ts                                # Root file
├── middlewares                             # Express Middlewares
├── models                                  # Sequelize Models
├── services                                # Model services
├── types                                   # Typing for entities and other stuff
├── utils
│   ├── AppConfig.ts                        # App global variables and configurations
│   ├── modelUtils.ts                       # Model helper functions
│   ├── modelValidation.ts                  # Model validation functions
│   ├── routeConfig.ts                      # Route decorator
│   └── tokenUtils.ts
└── views                                   # Api view
    └── index.html

Setup

You will need the following programs installed

  • Postgresql (should download version 13.6)
  • Nodejs (should download lts version)
  • Typescript

After installed all the above programs, following these step

  • Step 1: Create a database call food_ordering_app in postgresql(recommend using datagrip to make thing easier)
CREATE DATABASE foold_ordering_app
  • Step 2: Install dependencies
cd food-ordering-app
cd server
npm install # Or yarn
  • Step 3: Complete .env file
    • Change file env.sample to .env
    • Fill in required information
    • Example
    DB_NAME=food_ordering_app
    DB_HOST=localhost
    DB_USERNAME=user that own the database
    PORT=5002
    
  • Step 4: Run the api
    • If this is the first time you run api (this will compile ts to js and run database migrations)
    npm run build # Or yarn build
    • Mac OS/ Linux
    npm run server # Or yarn server
    • Windows
      • Run
      tsc -w
      • Copy folder views in server to server/dist
      • Then run
      npm run start # Or yarn start

To get the list of every route available, go to localhost:5002, you will see a screen with ui like this:

api home page

Or go to localhost:5002/api if you prefer json format

food-ordering-app's People

Contributors

nick-cb avatar ceres-vinguyen avatar pmduc1010 avatar quocanhh21 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.