We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 44e9a06 commit cced658Copy full SHA for cced658
.npmignore
@@ -0,0 +1,2 @@
1
+.travis.yml
2
+test
.travis.yml
@@ -0,0 +1,13 @@
+os:
+ - linux
3
+language: node_js
4
+node_js:
5
+ - '9'
6
+install:
7
+ - npm install npm@latest -g
8
+ - npm ci
9
+script:
10
+ - npm run test
11
+branches:
12
+ only:
13
+ - develop
test/gulpfile.js
@@ -0,0 +1,10 @@
+const gulp = require('gulp'),
+ compodoc = require('@compodoc/gulp-compodoc');
+
+gulp.task('default', () => {
+ return gulp.src('nest-app/src/**/*.ts')
+ .pipe(compodoc({
+ output: 'nest-app//documentation',
+ tsconfig: 'nest-app/tsconfig.json'
+ }))
+});
test/nest-app/src/app.controller.ts
@@ -0,0 +1,21 @@
+import { Get, Controller } from '@nestjs/common';
+import { AppService } from './app.service';
+@Controller()
+export class AppController {
+ constructor(private readonly appService: AppService) {}
+ @Get()
+ root(): string {
+ return this.appService.root();
+ }
+ @Auth(Roles.User)
14
+ @Post()
15
+ async create(@Body() body: CreateTodoDto, @AuthUser() authUser: User) {}
16
17
+ @UsePipes(new ValidationPipe())
18
+ @ApiResponse({ description: 'Return all articles.' })
19
+ @Post('multiple')
20
+ async createMultipleTodo(@Body() body: CreateMultipleTodoDto, @AuthUser() authUser: User) {}
21
+}
test/nest-app/src/app.module.ts
+import { Module } from '@nestjs/common';
+import { AppController } from './app.controller';
+@Module({
+ imports: [],
+ controllers: [AppController],
+ providers: [AppService],
+})
+export class AppModule {}
test/nest-app/src/app.service.ts
@@ -0,0 +1,8 @@
+import { Injectable } from '@nestjs/common';
+@Injectable()
+export class AppService {
+ return 'Hello World!';
test/nest-app/src/auth.controller.ts
@@ -0,0 +1,17 @@
+import { Controller, Headers, Post, Res, HttpStatus, Delete } from '@nestjs/common';
+@Controller('auth')
+export class AuthController {
+ constructor() {}
+ async login(@Headers() headers, @Res() res) {
+ @Delete()
+ async logout(@Res() res) {
test/nest-app/src/main.hmr.ts
@@ -0,0 +1,15 @@
+import { NestFactory } from '@nestjs/core';
+import { AppModule } from './app.module';
+declare const module: any;
+async function bootstrap() {
+ const app = await NestFactory.create(AppModule);
+ await app.listen(3000);
+ if (module.hot) {
+ module.hot.accept();
+ module.hot.dispose(() => app.close());
+bootstrap();
test/nest-app/src/main.ts
test/nest-app/src/user.entity.ts
@@ -0,0 +1,39 @@
+import {Entity, PrimaryGeneratedColumn, Column, BeforeInsert, JoinTable, ManyToMany, OneToMany} from "typeorm";
+import { IsEmail, Validate } from 'class-validator';
+import * as crypto from 'crypto';
+import { ArticleEntity } from '../article/article.entity';
+@Entity('user')
+export class UserEntity {
+ @PrimaryGeneratedColumn()
+ id: number;
+ @Column()
+ username: string;
+ @IsEmail()
+ email: string;
+ @Column({default: ''})
+ bio: string;
22
23
+ image: string;
24
25
26
+ password: string;
27
28
+ @BeforeInsert()
29
+ hashPassword() {
30
+ this.password = crypto.createHmac('sha256', this.password).digest('hex');
31
32
33
+ @ManyToMany(type => ArticleEntity)
34
+ @JoinTable()
35
+ favorites: ArticleEntity[];
36
37
+ @OneToMany(type => ArticleEntity, article => article.author)
38
+ articles: ArticleEntity[];
39
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments