commit
20f19e8d30
|
|
@ -0,0 +1,25 @@
|
||||||
|
module.exports = {
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
parserOptions: {
|
||||||
|
project: 'tsconfig.json',
|
||||||
|
sourceType: 'module',
|
||||||
|
},
|
||||||
|
plugins: ['@typescript-eslint/eslint-plugin'],
|
||||||
|
extends: [
|
||||||
|
'plugin:@typescript-eslint/eslint-recommended',
|
||||||
|
'plugin:@typescript-eslint/recommended',
|
||||||
|
'prettier',
|
||||||
|
'prettier/@typescript-eslint',
|
||||||
|
],
|
||||||
|
root: true,
|
||||||
|
env: {
|
||||||
|
node: true,
|
||||||
|
jest: true,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'@typescript-eslint/interface-name-prefix': 'off',
|
||||||
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||||
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||||
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
@ -389,3 +389,4 @@ Temporary Items
|
||||||
# Local
|
# Local
|
||||||
docker-compose.yml
|
docker-compose.yml
|
||||||
.env
|
.env
|
||||||
|
dist
|
||||||
|
|
|
||||||
13
README.md
13
README.md
|
|
@ -7,7 +7,7 @@
|
||||||
[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux
|
[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux
|
||||||
[linux-url]: https://travis-ci.org/nestjs/nest
|
[linux-url]: https://travis-ci.org/nestjs/nest
|
||||||
|
|
||||||
<p align="center">A progressive <a href="http://nodejs.org" target="blank">Node.js</a> framework for building efficient and scalable server-side applications, heavily inspired by <a href="https://angular.io" target="blank">Angular</a>.</p>
|
<p align="center">A progressive <a href="http://nodejs.org" target="blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
||||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
||||||
|
|
@ -15,11 +15,10 @@
|
||||||
<a href="https://travis-ci.org/nestjs/nest"><img src="https://api.travis-ci.org/nestjs/nest.svg?branch=master" alt="Travis" /></a>
|
<a href="https://travis-ci.org/nestjs/nest"><img src="https://api.travis-ci.org/nestjs/nest.svg?branch=master" alt="Travis" /></a>
|
||||||
<a href="https://travis-ci.org/nestjs/nest"><img src="https://img.shields.io/travis/nestjs/nest/master.svg?label=linux" alt="Linux" /></a>
|
<a href="https://travis-ci.org/nestjs/nest"><img src="https://img.shields.io/travis/nestjs/nest/master.svg?label=linux" alt="Linux" /></a>
|
||||||
<a href="https://coveralls.io/github/nestjs/nest?branch=master"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#5" alt="Coverage" /></a>
|
<a href="https://coveralls.io/github/nestjs/nest?branch=master"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#5" alt="Coverage" /></a>
|
||||||
<a href="https://gitter.im/nestjs/nestjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge"><img src="https://badges.gitter.im/nestjs/nestjs.svg" alt="Gitter" /></a>
|
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
||||||
<a href="https://opencollective.com/nest#backer"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
<a href="https://opencollective.com/nest#backer"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
||||||
<a href="https://opencollective.com/nest#sponsor"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
<a href="https://opencollective.com/nest#sponsor"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
||||||
<a href="https://paypal.me/kamilmysliwiec"><img src="https://img.shields.io/badge/Donate-PayPal-dc3d53.svg"/></a>
|
<a href="https://paypal.me/kamilmysliwiec"><img src="https://img.shields.io/badge/Donate-PayPal-dc3d53.svg"/></a>
|
||||||
<img src="https://img.shields.io/badge/👌-Production Ready-78c7ff.svg"/>
|
|
||||||
<a href="https://twitter.com/nestframework"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
|
<a href="https://twitter.com/nestframework"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
|
||||||
</p>
|
</p>
|
||||||
<!--[](https://opencollective.com/nest#backer)
|
<!--[](https://opencollective.com/nest#backer)
|
||||||
|
|
@ -45,7 +44,7 @@ $ npm run start
|
||||||
$ npm run start:dev
|
$ npm run start:dev
|
||||||
|
|
||||||
# production mode
|
# production mode
|
||||||
npm run start:prod
|
$ npm run start:prod
|
||||||
```
|
```
|
||||||
|
|
||||||
## Test
|
## Test
|
||||||
|
|
@ -63,14 +62,14 @@ $ npm run test:cov
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://opencollective.com/nest).
|
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||||
|
|
||||||
## Stay in touch
|
## Stay in touch
|
||||||
|
|
||||||
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
|
- Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
|
||||||
- Website - [https://nestjs.com](https://nestjs.com/)
|
- Website - [https://nestjs.com](https://nestjs.com/)
|
||||||
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Nest is [MIT licensed](LICENSE).
|
Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"collection": "@nestjs/schematics",
|
||||||
|
"sourceRoot": "src"
|
||||||
|
}
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"watch": ["src"],
|
|
||||||
"ext": "ts",
|
|
||||||
"ignore": ["src/**/*.spec.ts"],
|
|
||||||
"exec": "ts-node -r tsconfig-paths/register src/main.ts"
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
74
package.json
74
package.json
|
|
@ -1,49 +1,69 @@
|
||||||
{
|
{
|
||||||
"name": "nest-typescript-starter",
|
"name": "nest-typescript-starter",
|
||||||
|
"private": true,
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Nest TypeScript starter repository",
|
"description": "Nest TypeScript starter repository",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"format": "prettier --write \"**/*.ts\"",
|
"prebuild": "rimraf dist",
|
||||||
"start": "ts-node -r tsconfig-paths/register src/main.ts",
|
"build": "nest build",
|
||||||
"start:dev": "nodemon",
|
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||||
"prestart:prod": "rm -rf dist && tsc",
|
"start": "nest start",
|
||||||
"start:prod": "node dist/main.js",
|
"start:dev": "nest start --watch",
|
||||||
|
"start:debug": "nest start --debug --watch",
|
||||||
|
"start:prod": "node dist/main",
|
||||||
|
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
|
"test:watch": "jest --watch",
|
||||||
"test:cov": "jest --coverage",
|
"test:cov": "jest --coverage",
|
||||||
|
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
||||||
"test:e2e": "jest --config ./test/jest-e2e.json"
|
"test:e2e": "jest --config ./test/jest-e2e.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nestjs/common": "^4.5.9",
|
"@nestjs/common": "^7.1.1",
|
||||||
"@nestjs/core": "^4.5.10",
|
"@nestjs/core": "^7.1.1",
|
||||||
"@nestjs/microservices": "^4.5.8",
|
"@nestjs/platform-express": "^7.1.1",
|
||||||
"@nestjs/testing": "^4.5.5",
|
"reflect-metadata": "^0.1.13",
|
||||||
"@nestjs/websockets": "^4.5.8",
|
"rimraf": "^3.0.2",
|
||||||
"reflect-metadata": "^0.1.12",
|
"rxjs": "^6.5.5"
|
||||||
"rxjs": "^5.5.6",
|
|
||||||
"typescript": "^2.6.2"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/express": "^4.0.39",
|
"@nestjs/cli": "^7.2.0",
|
||||||
"@types/jest": "^21.1.8",
|
"@nestjs/schematics": "^7.0.0",
|
||||||
"@types/node": "^9.3.0",
|
"@nestjs/testing": "^7.1.1",
|
||||||
"@types/supertest": "^2.0.4",
|
"@types/express": "^4.17.6",
|
||||||
"jest": "^21.2.1",
|
"@types/jest": "^25.2.3",
|
||||||
"nodemon": "^1.14.1",
|
"@types/node": "^14.0.6",
|
||||||
"prettier": "^1.11.1",
|
"@types/supertest": "^2.0.9",
|
||||||
"supertest": "^3.0.0",
|
"@typescript-eslint/eslint-plugin": "^3.0.2",
|
||||||
"ts-jest": "^21.2.4",
|
"@typescript-eslint/parser": "^3.0.2",
|
||||||
"ts-node": "^4.1.0",
|
"eslint": "^7.1.0",
|
||||||
"tsconfig-paths": "^3.1.1",
|
"eslint-config-prettier": "^6.11.0",
|
||||||
"tslint": "5.3.2"
|
"eslint-plugin-import": "^2.20.2",
|
||||||
|
"jest": "^26.0.1",
|
||||||
|
"prettier": "^2.0.5",
|
||||||
|
"supertest": "^4.0.2",
|
||||||
|
"ts-jest": "^26.1.0",
|
||||||
|
"ts-loader": "^7.0.5",
|
||||||
|
"ts-node": "^8.10.2",
|
||||||
|
"tsconfig-paths": "^3.9.0",
|
||||||
|
"typescript": "^3.9.3"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"moduleFileExtensions": ["js", "json", "ts"],
|
"moduleFileExtensions": [
|
||||||
|
"js",
|
||||||
|
"json",
|
||||||
|
"ts"
|
||||||
|
],
|
||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
"testRegex": ".spec.ts$",
|
"testRegex": ".spec.ts$",
|
||||||
"transform": {
|
"transform": {
|
||||||
"^.+\\.(t|j)s$": "ts-jest"
|
"^.+\\.(t|j)s$": "ts-jest"
|
||||||
},
|
},
|
||||||
"coverageDirectory": "../coverage"
|
"collectCoverageFrom": [
|
||||||
|
"**/*.(t|j)s"
|
||||||
|
],
|
||||||
|
"coverageDirectory": "../coverage",
|
||||||
|
"testEnvironment": "node"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Test, TestingModule } from '@nestjs/testing';
|
import { Test, TestingModule } from '@nestjs/testing';
|
||||||
import { INestApplication } from '@nestjs/common';
|
|
||||||
import { AppController } from './app.controller';
|
import { AppController } from './app.controller';
|
||||||
|
import { AppService } from './app.service';
|
||||||
|
|
||||||
describe('AppController', () => {
|
describe('AppController', () => {
|
||||||
let app: TestingModule;
|
let app: TestingModule;
|
||||||
|
|
@ -8,13 +8,14 @@ describe('AppController', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
app = await Test.createTestingModule({
|
app = await Test.createTestingModule({
|
||||||
controllers: [AppController],
|
controllers: [AppController],
|
||||||
|
providers: [AppService],
|
||||||
}).compile();
|
}).compile();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('root', () => {
|
describe('getHello', () => {
|
||||||
it('should return "Hello World!"', () => {
|
it('should return "Hello World!"', () => {
|
||||||
const appController = app.get<AppController>(AppController);
|
const appController = app.get<AppController>(AppController);
|
||||||
expect(appController.root()).toBe('Hello World!');
|
expect(appController.getHello()).toBe('Hello World!');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
import { Get, Controller } from '@nestjs/common';
|
import { Controller, Get } from '@nestjs/common';
|
||||||
|
import { AppService } from './app.service';
|
||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
export class AppController {
|
export class AppController {
|
||||||
|
constructor(private readonly appService: AppService) {}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
root(): string {
|
getHello(): string {
|
||||||
return 'Hello World!';
|
return this.appService.getHello();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { AppController } from './app.controller';
|
import { AppController } from './app.controller';
|
||||||
|
import { AppService } from './app.service';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [],
|
imports: [],
|
||||||
controllers: [AppController],
|
controllers: [AppController],
|
||||||
components: [],
|
providers: [AppService],
|
||||||
})
|
})
|
||||||
export class AppModule {}
|
export class AppModule {}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class AppService {
|
||||||
|
getHello(): string {
|
||||||
|
return 'Hello World!';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import request from 'supertest';
|
import * as request from 'supertest';
|
||||||
import { Test } from '@nestjs/testing';
|
import { Test } from '@nestjs/testing';
|
||||||
import { AppModule } from './../src/app.module';
|
import { AppModule } from './../src/app.module';
|
||||||
import { INestApplication } from '@nestjs/common';
|
import { INestApplication } from '@nestjs/common';
|
||||||
|
|
@ -15,7 +15,7 @@ describe('AppController (e2e)', () => {
|
||||||
await app.init();
|
await app.init();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('/GET /', () => {
|
it('/ (GET)', () => {
|
||||||
return request(app.getHttpServer())
|
return request(app.getHttpServer())
|
||||||
.get('/')
|
.get('/')
|
||||||
.expect(200)
|
.expect(200)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"moduleFileExtensions": ["js", "json", "ts"],
|
"moduleFileExtensions": ["js", "json", "ts"],
|
||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
|
"testEnvironment": "node",
|
||||||
"testRegex": ".e2e-spec.ts$",
|
"testRegex": ".e2e-spec.ts$",
|
||||||
"transform": {
|
"transform": {
|
||||||
"^.+\\.(t|j)s$": "ts-jest"
|
"^.+\\.(t|j)s$": "ts-jest"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
|
||||||
|
}
|
||||||
|
|
@ -1,24 +1,15 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"declaration": false,
|
"declaration": true,
|
||||||
"noImplicitAny": false,
|
|
||||||
"removeComments": true,
|
"removeComments": true,
|
||||||
"noLib": false,
|
|
||||||
"allowSyntheticDefaultImports": true,
|
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"target": "es6",
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"target": "es2017",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"allowJs": true,
|
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"baseUrl": "./src"
|
"baseUrl": "./",
|
||||||
},
|
"incremental": true
|
||||||
"include": [
|
}
|
||||||
"src/**/*"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules",
|
|
||||||
"**/*.spec.ts"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
55
tslint.json
55
tslint.json
|
|
@ -1,55 +0,0 @@
|
||||||
{
|
|
||||||
"defaultSeverity": "error",
|
|
||||||
"extends": [
|
|
||||||
"tslint:recommended"
|
|
||||||
],
|
|
||||||
"jsRules": {
|
|
||||||
"no-unused-expression": true
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"eofline": false,
|
|
||||||
"quotemark": [
|
|
||||||
true,
|
|
||||||
"single"
|
|
||||||
],
|
|
||||||
"indent": false,
|
|
||||||
"member-access": [
|
|
||||||
false
|
|
||||||
],
|
|
||||||
"ordered-imports": [
|
|
||||||
false
|
|
||||||
],
|
|
||||||
"max-line-length": [
|
|
||||||
true,
|
|
||||||
150
|
|
||||||
],
|
|
||||||
"member-ordering": [
|
|
||||||
false
|
|
||||||
],
|
|
||||||
"curly": false,
|
|
||||||
"interface-name": [
|
|
||||||
false
|
|
||||||
],
|
|
||||||
"array-type": [
|
|
||||||
false
|
|
||||||
],
|
|
||||||
"no-empty-interface": false,
|
|
||||||
"no-empty": false,
|
|
||||||
"arrow-parens": false,
|
|
||||||
"object-literal-sort-keys": false,
|
|
||||||
"no-unused-expression": false,
|
|
||||||
"max-classes-per-file": [
|
|
||||||
false
|
|
||||||
],
|
|
||||||
"variable-name": [
|
|
||||||
false
|
|
||||||
],
|
|
||||||
"one-line": [
|
|
||||||
false
|
|
||||||
],
|
|
||||||
"one-variable-per-declaration": [
|
|
||||||
false
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"rulesDirectory": []
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue