项目作者: KyLeoHC

项目描述 :
🚀🖨A big file upload example project written by nestJS.
高级语言: TypeScript
项目地址: git://github.com/KyLeoHC/node-nestjs.git
创建时间: 2019-12-22T01:47:36Z
项目社区:https://github.com/KyLeoHC/node-nestjs

开源协议:MIT License

下载


node-nestjs

This is a big file upload example project written by nestJS.

feature

Getting started

Installation

Install dependencies

  1. $ npm ci

or

  1. $ npm install

Running the app

  1. # development
  2. $ npm run start
  3. # watch mode
  4. $ npm run start:dev
  5. # watch mode with hot module replacement
  6. $ npm run start:hmr
  7. # debug app
  8. $ npm run start:debug
  9. # build app
  10. $ npm run build
  11. # launch in test environment
  12. $ npm run launch:test
  13. # launch in production environment
  14. $ npm run launch:prod

Test

  1. # unit tests
  2. $ npm run test
  3. # e2e tests
  4. $ npm run test:e2e
  5. # test coverage
  6. $ npm run test:cov

Database

The example codebase uses Typeorm with MongoDB.

Create a new mongo database with the name db_net_disk(or the name you specified in the config.db)

Set database settings in congfig/index.ts:

  1. {
  2. ...other config
  3. db: {
  4. type: 'mongodb',
  5. host: process.env.DATABASE_HOST || 'localhost',
  6. port: parseInt(process.env.DATABASE_PORT || '27017', 10),
  7. username: 'ndUser',
  8. password: '123456',
  9. database: 'db_net_disk',
  10. synchronize: true,
  11. logging: true
  12. }
  13. ...other config
  14. }

On application start, collections for all entities will be created.

Project structure

  1. .
  2. ├── config: application config directory
  3. ├── config.dev.js: config for development environment
  4. ├── config.pre.js: config for pre production environment
  5. ├── config.production.js: config for production environment
  6. ├── config.test.js: config for test environment
  7. └── index.js: base config
  8. ├── docs: project document directory
  9. ├── src
  10. ├── common: common directory
  11. ├── dto: common dto directory
  12. ├── entities: common entitie directory
  13. ├── enums: common enum directory
  14. ├── exceptions: common exception directory
  15. ├── filters: common filter directory
  16. ├── interceptors: common interceptor directory
  17. └── pipes: common dto directory
  18. ├── utils: uility function directory
  19. ├── modules: nest module directory
  20. ├── user: user module directory
  21. ├── dto: dto directory for user module
  22. ├── entities: entity directory for user module
  23. ├── user.controller.ts: user controller
  24. ├── user.module.ts: user module
  25. └── user.service.ts: user service
  26. ├── file: file module directory
  27. └── ...
  28. ├── auth: auth module directory
  29. └── ...
  30. └── app-logger: app logger module directory
  31. └── ...
  32. ├── app.controller.ts: app controller
  33. ├── app.controller.spec.ts: unit test for app controller
  34. ├── app.service.ts: app service
  35. ├── app.module.ts: app module
  36. └── main.ts: main entry
  37. └── test: e2e test directory
  38. └── app.e2e-spec.ts
  39. └── jest-e2e.json

Frontend

See node-nestjs-frontend.

You can run node-nestjs and node-nestjs-frontend at the same time.So you can see the interaction effect.

License

MIT License