- Cài đặt global để cung cấp câu lệnh mặc định trong command line
- typescipt: Ngôn ngữ lập trình Typescipt
- ts-node: Trình biên dịch từ typescript sang javascript
- nodemon: Kiểm tra sự thay đổi của code
$ sudo npm install -g typescript ts-node nodemon
Cách sử dụng:
$ tsc node.ts
- Cài đặt trực tiếp trên project
$ npm install typescript ts-node nodemon
Cách sử dụng:
$ ./node_module/typescript/bin/tsc node.ts
$ npm init
$ tsc --init
- Cấu hình
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"moduleResolution": "node",
"esModuleInterop": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"]
}
- express: framework dành cho Nodejs
- mongoose: thư viện xử lý CSDL trong mongoDB
- body-parser: chuyển đổi dữ liệu body sang json (từ express phiên bản 4 trở lên đã hỗ trợ sẵn body-parser)
$ npm install --save express mongoose
- @types/express: hỗ trợ cú pháp es6 cho express
- @types/mongoose: hỗ trợ cú pháp es6 cho mongoose
$ npm install --save-dev @types/express @types/mongoose