- Initialize Project and Install Dependencies
npm init -y
npm i express dotenv cors express-validator @prisma/client
npm i -D typescript @types/node @types/express @types/dotenv @types/cors
npm i --save-dev prisma esbuild-register nodemon
- Initialize Prisma
npx prisma init --datasource-provider mongodb
- Install dependencies
npm install
- Make sure the database is up to date to the schema
npx prisma db push
- Seed the database (optional)
npx prisma db seed
- Create a
.env
file in the root directory and add the following environment variables
.env.example
DATABASE_URL=mysql://user:password@localhost:3306/mydb
PORT=1337
STORAGE_BUCKET=sweepin.xxx.com
NEXT_PUBLIC_BASE_URL=http://localhost:3000
- Run the server
npm run dev