This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Controller, Get, Req, Res, UseGuards } from '@nestjs/common'; | |
import { Request, Response } from 'express'; | |
import { GoogleOauthGuard } from './google-oauth.guard'; | |
@Controller('auth/google') | |
export class GoogleOauthController { | |
constructor(private jwtAuthService: JwtAuthService) {} | |
@Get() | |
@UseGuards(GoogleOauthGuard) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Controller, Get, Res, Req } from '@nestjs/common'; | |
import { Request, Response } from 'express'; | |
import { parse } from 'url'; | |
import { ViewService } from './view.service'; | |
@Controller('/') | |
export class ViewController { | |
constructor(private viewService: ViewService) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("<Component />", () => { | |
it("works", () => { | |
// ... | |
}): | |
describe("when something silly happens", () => { | |
beforeEach(() => { | |
jest.mock("MyOtherComponent", () => { | |
// ... | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"client:generate:schema": "zeus <path-ot-schema> <output-folder> --typescript --apollo" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { NextPage } from 'next'; | |
const Home: NextPage = () => { | |
return <h1>Hello from NextJS! - Home</h1>; | |
}; | |
export default Home; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jest.mock("MyOtherComponent", () => { | |
return require | |
.requireActual("TestUtils") | |
.mockOriginalFunctionality("MyOtherComponent"); | |
}); | |
describe("<Component />", () => { | |
it("works", () => { | |
// MyOtherComponent works as usual | |
}): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yarn add next react react-dom | |
yarn add --dev @types/react @types/react-dom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.oauth2Client.getTokenInfo( | |
req.user.accessToken, | |
); | |
tokenInfo { | |
web_1 | expiry_date: 1619210156644, | |
web_1 | scopes: [ | |
web_1 | 'https://www.googleapis.com/auth/userinfo.email', | |
web_1 | 'https://www.googleapis.com/auth/userinfo.profile', | |
web_1 | 'openid' | |
web_1 | ], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/client/.eslintrc.js | |
// Your custom ESLint file for React, applied only to src/client automatically | |
module.exports = { | |
parser: '@typescript-eslint/parser', | |
parserOptions: { | |
project: 'src/client/tsconfig.json', | |
sourceType: 'module', | |
}, | |
plugins: ['@typescript-eslint/eslint-plugin'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@nestjs/common'; | |
import { AuthGuard } from '@nestjs/passport'; | |
@Injectable() | |
export class JwtAuthGuard extends AuthGuard('jwt') {} |
NewerOlder