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
touch tsconfig.json | |
yarn add --dev typescript @types/react @types/node |
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 App, { Container } from 'next/app' | |
export default class MyApp extends App { | |
static async getInitialProps({ Component, router, ctx }) { | |
let pageProps = {} | |
if (Component.getInitialProps) { | |
pageProps = await Component.getInitialProps(ctx) | |
} |
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
if (workbox) { | |
console.log(`Yay! Workbox is loaded 🎉`); | |
// workbox.setConfig({ debug: false }); | |
// workbox.precaching.suppressWarnings(); | |
workbox.precaching.precacheAndRoute(self.__precacheManifest, {}); | |
workbox.routing.registerRoute(/^https?.*/, workbox.strategies.networkFirst(), 'GET'); | |
} else { | |
console.log(`Boo! Workbox didn't load 😬`); | |
} |
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
const compose = require('next-compose'); | |
const withSass = require('@zeit/next-sass'); | |
const { InjectManifest } = require('workbox-webpack-plugin'); | |
module.exports = compose([ | |
[withSass], | |
{ | |
webpack: config => { | |
const swOptions = { |
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 { Module } from '@nestjs/common'; | |
import { AppController } from './app.controller'; | |
import { AppService } from './app.service'; | |
import { ConfigModule } from './config/config.module'; | |
@Module({ | |
imports: [ConfigModule], | |
controllers: [AppController], | |
providers: [AppService], | |
}) |
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 { Module } from '@nestjs/common'; | |
import { ConfigService } from './config.service'; | |
@Module({ | |
providers: [ | |
{ | |
// Load the service as a provider | |
provide: ConfigService, | |
// Tells the service which file to load upon initialization |
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 * as dotenv from 'dotenv'; | |
import * as Joi from 'joi'; | |
import * as fs from 'fs'; | |
export interface EnvConfig { | |
[key: string]: string; | |
} | |
/** | |
* ConfigService is used the load, validate and inject our projects configuration |