-
npm init -y
-
npm i prisma nodemon -D
-
npm i @prisma/client
-
npx prisma init
-
set NODE_TLS_REJECT_UNAUTHORIZED=0
for ignore SSL certificate if that needed
$ npx prisma init ✔ Your Prisma schema was created at prisma/schema.prisma You can now open it in your favorite editor. Next steps: 1. Set the DATABASE_URL in the .env file to point to your existing database. If your database has no tables yet, read https://pris.ly/d/getting-started 2. Set the provider of the datasource block in schema.prisma to match your database: postgresql, mysql, sqlite, sqlserver, mongodb or cockroachdb. 3. Run prisma db pull to turn your database schema into a Prisma schema. 4. Run prisma generate to generate the Prisma Client. You can then start querying your database. More information in our documentation: https://pris.ly/d/getting-started
-
-
Add DB URL to
.env
file -
Edit
prisma/schema.prisma
file, add models -
npx prisma migrate dev
(create DB & sql file, repeat after any changes in prisma schema) -
To add the mock data
-
Create
seed.js
file -
Add to
package.json
"prisma": { "seed": "node prisma/seed.js" }
-
And add
"type": "module"
for use import intoseed.js
file -
npx prisma db seed
DB seeding also by `prisma migrate db` & `prisma migrate reset`
-
-
Add next packages:
fastify
- web-server (the analog of express)dotenv
- read.env
file@fastify/cookie
- parse and set cookie headers (for authorization)@fastify/cors
- enables the use of CORS@fastify/sensible
- adds some useful decorators such as HTTP errors and assertions
-
Create
server.js
file -
npm i body-parser
============================================
- Try express instead of fastify
- add packages:
express cors cookie-parser express-validator bcryptjs jsonwebtoken uuid
- add packages:
- mobx
- mobx-react-lite
- axios
- @types/axios (-D)
StrictMode redraws components twice!!!