Install Dev Dependencies 1
npm i -D typescript ts-node ts-node-dev
npm i -D @types/node
{
"rootDir": "./src",
"outDir": "./dist"
}
Install Dev Dependencies 2
Configure Nodemon (modemon.json)
{
"watch": [
"src"
],
"ext": "ts,json",
"ignore": [
"src/**/*.spec.ts"
],
"exec": "ts-node ./src/index.ts"
}
"scripts": {
"build": "tsc -p .",
"start": "node dist/index.js",
"dev": "nodemon",
"dev2": "ts-node-dev src/index.ts"
},
Install Dev Dependencies 3
npx prisma init --datasource-provider sqlite
model Post {
id Int @id @default(autoincrement())
title String
content String
published Boolean @default(false)
createAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@map("posts")
}
DATABASE_URL="file:../db/demo.db"
npx prisma generate
npx prisma db push