Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kyleohc/node-nestjs
ððĻA big file upload example project written by nestJS.
https://github.com/kyleohc/node-nestjs
big-file file-upload mongodb nestjs nestjs-backend nodejs typeorm
Last synced: 3 months ago
JSON representation
ððĻA big file upload example project written by nestJS.
- Host: GitHub
- URL: https://github.com/kyleohc/node-nestjs
- Owner: KyLeoHC
- License: mit
- Created: 2019-12-22T01:47:36.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-24T01:01:16.000Z (almost 2 years ago)
- Last Synced: 2023-03-08T17:13:06.157Z (almost 2 years ago)
- Topics: big-file, file-upload, mongodb, nestjs, nestjs-backend, nodejs, typeorm
- Language: TypeScript
- Homepage:
- Size: 616 KB
- Stars: 12
- Watchers: 3
- Forks: 1
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-nestjs
This is a big file upload example project written by nestJS.
## feature
* [x] **[Nest](https://github.com/nestjs/nest)**
* [x] [MongoDB](https://www.mongodb.com/) with [typeorm](https://github.com/typeorm/typeorm)
* [X] [class-validator](https://github.com/typestack/class-validator)
* [x] [Jest](https://github.com/facebook/jest)
* [x] [winston](https://github.com/winstonjs/winston)
* [x] [Helmet](https://github.com/helmetjs/helmet)
* [x] [Multer](https://github.com/expressjs/multer)
* [x] [Passport](https://github.com/jaredhanson/passport) for `JWT` authentication
* [x] Support `hmr` and bundle server-side code with [Webpack](https://github.com/webpack/webpack)## Getting started
### Installation
Install dependencies
```bash
$ npm ci
```
or
```bash
$ npm install
```### Running the app
```bash
# development
$ npm run start# watch mode
$ npm run start:dev# watch mode with hot module replacement
$ npm run start:hmr# debug app
$ npm run start:debug# build app
$ npm run build# launch in test environment
$ npm run launch:test# launch in production environment
$ npm run launch:prod
```### Test
```bash
# unit tests
$ npm run test# e2e tests
$ npm run test:e2e# test coverage
$ npm run test:cov
```### Database
The example codebase uses [Typeorm](http://typeorm.io/) 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`:
```typesctipt
{
...other config
db: {
type: 'mongodb',
host: process.env.DATABASE_HOST || 'localhost',
port: parseInt(process.env.DATABASE_PORT || '27017', 10),
username: 'ndUser',
password: '123456',
database: 'db_net_disk',
synchronize: true,
logging: true
}
...other config
}
```On application start, collections for all entities will be created.
## Project structure
```txt
.
âââ config: application config directory
â  âââ config.dev.js: config for development environment
â  âââ config.pre.js: config for pre production environment
â  âââ config.production.js: config for production environment
â  âââ config.test.js: config for test environment
â  âââ index.js: base config
âââ docs: project document directory
âââ src
â  âââ common: common directory
â  â  âââ dto: common dto directory
â  â  âââ entities: common entitie directory
â  â  âââ enums: common enum directory
â  â  âââ exceptions: common exception directory
â  â  âââ filters: common filter directory
â  â  âââ interceptors: common interceptor directory
â  â  âââ pipes: common dto directory
â  âââ utils: uility function directory
â  âââ modules: nest module directory
â  â  âââ user: user module directory
â  â  â âââ dto: dto directory for user module
â  â  â âââ entities: entity directory for user module
â  â  â âââ user.controller.ts: user controller
â  â  â âââ user.module.ts: user module
â  â  â âââ user.service.ts: user service
â  â  âââ file: file module directory
â  â  â âââ ...
â  â  âââ auth: auth module directory
â  â  â âââ ...
â  â  âââ app-logger: app logger module directory
â  â  âââ ...
â  âââ app.controller.ts: app controller
â  âââ app.controller.spec.ts: unit test for app controller
â  âââ app.service.ts: app service
â  âââ app.module.ts: app module
â  âââ main.ts: main entry
âââ test: e2e test directory
  âââ app.e2e-spec.ts
  âââ jest-e2e.json
```## Frontend
See [node-nestjs-frontend](https://github.com/KyLeoHC/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](https://github.com/KyLeoHC/node-nestjs/blob/master/LICENSE)