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
-
Clone repo
-
Install packages by running
npm i -
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>
- Create DB and run migrations
npx sequelize db:create
npx sequelize db:migrate
npx sequelize db:seed:all
- Run server with
nodemon index.mjs
Alternatively, if nodemon is not installed, node index.mjs will also work.
-
Optionally configure node.json to watch for certain file extensions (.js / .mjs)
-
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
- category: Product Category of 3D model
- model: 3D Model information
- order: Purchase details of customer's orders
- user: Customer login and information
All routes are maintained in routes.mjs
- create an api in the desired controller file, and then expose an endpoint route for the api
