- ExpressJS
- Sequelize
- PostgreSQL
- CORS
- Nodemon
- React
- Typescript
- Reduxtoolkit
- RTK Query
- PostgreQSL database: https://railway.app/
- ExpressJS server: https://railway.app/
- React client via Vite: https://vercel.com/
- Node 18.x.x +
- PostgreSQL 14.xx.x +
- Copy repo by instruction https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/adding-and-cloning-repositories/cloning-and-forking-repositories-from-github-desktop.
- Open project locally.
- Go to terminal:
cd server
npm i
cd ../client
npm i
.
Create database(you need to write you correct database username and password in server/db/config/config.js in development object) by
cd server/db
sequelize-cli db:create
sequelize-cli db:migrate
sequelize-cli db:seed:all
- Go to server root directory
- Run command
npm run dev
- Go to client root directory
- Run command
npm run dev
sequelize-cli db:create
-create databasesequelize-cli db:migrate
-migrate database tablessequelize-cli db:migrate:undo:all
-revert all database tablessequelize-cli db:seed
-seed datasequelize-cli db:seed:undo:all
-revert all seed
Note:can manage different databases by commands and their configuration in ./server/db/config/config.js and use in choosen enviroment by adding attribute --env:NODE_ENV
. For example in production env --env:production
API endpoints from root url (for example: https://example.com/):
- api/shop
- method
POST
body{name:string}
create shop- response
{id:number,name:string,ctreatedAt:date,updatedAt:date}
- response
- method
GET
get all shop- response
[{id:number,name:string,ctreatedAt:date,updatedAt:date},{id:number,name:string,ctreatedAt:date,updatedAt:date}...]
- response
- method
- api/shop/:id
- method ```GET`` get shop by id
- response
{id:number,name:string,ctreatedAt:date,updatedAt:date}
- response
- method ```DELETE`` delete shop by id
- method ```GET`` get shop by id
- api/product
- method
POST
body{name:string, image:file, price:number, shopId:number}
create product- response
{id:number,name:string, image:file, price:number, shopId:number,ctreatedAt:date,updatedAt:date}
- response
- method
- api/product/all
- method
GET
get all product- response
[{id:number,name:string, image:file, price:number, shopId:number,ctreatedAt:date,updatedAt:date},{id:number,name:string, image:file, price:number, shopId:number,ctreatedAt:date,updatedAt:date}...]
- response
- method
- api/product/:id
- method ```GET`` get product by id
- response
{id:number,name:string, image:file, price:number, shopId:number,ctreatedAt:date,updatedAt:date}
- response
- method ```DELETE`` delete delete by id
- method ```GET`` get product by id
- api/product/all/:shop
- method
GET
get all product by shopId- response
[{id:number,name:string, image:file, price:number, shopId:number,ctreatedAt:date,updatedAt:date},{id:number,name:string, image:file, price:number, shopId:number,ctreatedAt:date,updatedAt:date}...]
- response
- api/order
- method
POST
body{ "products":[ { "id": 2, "name": "ChickenBurger", "image": "f708739e-52a2-4974-b554-3a8e6caeddb6.jpg", "price": 3, "shopId": 2 }, { "id": 4, "name": "Cola", "image": "ef76c230-5778-48d3-b31a-5e9955a3f8e0.jpg", "price": 5, "shopId": 2 } ], "userName": "Nick", "userEmail":"gmail@mail.com", "userPhone": "+38066456789671", "userAddress":"Kyiv 1", "shopAddress":"Kyiv 2" }
- create order
- method
- api/order/email
-
- method
POST
bodyemail:string
- response - list of orders
- method
-
- api/order/phone
-
- method
POST
bodyphone:string
- response - list of orders
- method
-