npm

ts-user

1.0.1 • Public • Published
  1. npm init -y
  2. npm install express
  3. npm install typescript ts-node @types/express @types/node --save-dev
  4. npm install --save-dev ts-node-dev
  5. npm install --save-dev nodemon ts-node
  6. npm install --save-dev jest @types/jest ts-jest
  7. npm install @nestjs/testing --save-dev
  8. npx tsc --init

Installare Prisma

  1. npm install @prisma/client
  2. npm install -D prisma
  3. npx prisma init

nel file .env => DATABASE_URL="postgresql://user:password@localhost:5432/mydatabase"


Istruzioni Docker docker build -t ts_user . docker run --name ts_user-container -d -p 5432:5432 ts_user


package.json ... "scripts": { "test": "jest", "build": "tsc", "start": "node dist/index.js", "dev": "ts-node-dev --respawn src/index.ts", "start:dev": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/index.ts" }, ...

tsconfig.json { "compilerOptions": { "target": "es2016", "module": "commonjs", "strict": true, "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "rootDir": "./src", "outDir": "./dist" }, "include": ["src"], "exclude": ["node_modules"] }

jest.config.js module.exports = { preset: "ts-jest", testEnvironment: "node", testMatch: ["/tests//*.spec.ts"], };


.gitignore node_modules/ dist/


Command list

tsc -w -> start watch mode


Structure src/ |-- controllers/ | |-- user.controller.ts |-- services/ | |-- user.service.ts |-- repositories/ | |-- user.repository.ts |-- models/ | |-- user.model.ts |-- tests/ | |-- user.controller.spec.ts

Readme

Keywords

none

Package Sidebar

Install

npm i ts-user

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

20.5 kB

Total Files

41

Last publish

Collaborators

  • antvision