Skip to content

thereseLYR/3D-Model-Ecommerce-Backend

Repository files navigation

PorkyPrints-Backend

PorkyPrints

Setup

This project is the backend repository of PorkyPrints. It is to be run with PorkyPrints-Frontend. Before running the server locally, be sure to perform these steps

  1. Clone repo

  2. Install packages by running npm i

  3. Create a .env file with these set of configurations

POSTGRES_USERNAME=<username>
POSTGRES_PASSWORD=<password>
POSTGRES_HOST=127.0.0.1
POSTGRES_DATABASE=3d-model-ecommerce-development
SALT=3d-model
STRIPE_SECRET_KEY=<stripe_sk>
  1. Create DB and run migrations
npx sequelize db:create
npx sequelize db:migrate
npx sequelize db:seed:all
  1. Run server with
nodemon index.mjs

Alternatively, if nodemon is not installed, node index.mjs will also work.

  1. Optionally configure node.json to watch for certain file extensions (.js / .mjs)

  2. Other Sequelize commands

  • Use these commands to generate migrations and seeders
npx sequelize migration:generate --name create-tables
npx sequelize seed:generate --name seed-data
  • Destructive actions to undo a migration/seeding/drop table
npx sequelize db:migrate:undo
npx sequelize db:seed:undo
npx sequelize db:drop

Models

ERD Diagram

  • category: Product Category of 3D model
  • model: 3D Model information
  • order: Purchase details of customer's orders
  • user: Customer login and information

Router and Controllers

All routes are maintained in routes.mjs

  • create an api in the desired controller file, and then expose an endpoint route for the api

About

3D-Model-Ecommerce-Backend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors