This file contains hidden or 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 { NextPageContext } from "next"; | |
| const Error = ({ statusCode }) => { | |
| return ( | |
| <p> | |
| {statusCode | |
| ? `An error ${statusCode} occurred on server` | |
| : "An error occurred on client"} | |
| </p> | |
| ); |
This file contains hidden or 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
| { | |
| "extends": "./tsconfig.json", | |
| "compilerOptions": { | |
| "module": "commonjs", | |
| "outDir": "dist", | |
| "noEmit": false | |
| }, | |
| "include": ["server"] | |
| } |
This file contains hidden or 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 express, { Request, Response } from "express"; | |
| import next from "next"; | |
| const dev = process.env.NODE_ENV !== "production"; | |
| const app = next({ dev }); | |
| const handle = app.getRequestHandler(); | |
| const port = process.env.PORT || 3000; | |
| (async () => { | |
| try { |
This file contains hidden or 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
| { | |
| "editor.formatOnSave": false, | |
| "editor.codeActionsOnSave": { | |
| "source.fixAll.eslint": true | |
| } | |
| } |
This file contains hidden or 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 moduleAlias from "module-alias"; | |
| import path from "path"; | |
| const rootPath = path.resolve(__dirname, "..", "dist"); | |
| moduleAlias.addAliases({ | |
| "~": rootPath | |
| }); |
This file contains hidden or 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
| export const formatName = (firstName: string, lastName: string) => { | |
| return `${firstName} ${lastName}`; | |
| }; |
This file contains hidden or 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 { formatName } from "~/utils/helpers/format-name"; | |
| export class User { | |
| get fullName() { | |
| return formatName("John", "Doe"); | |
| } | |
| } |
This file contains hidden or 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
| function addLinks () { | |
| for (var i=0, link; i<5; i++) { | |
| link = document.createElement("a"); | |
| link.innerHTML = "Link " + i; | |
| link.onclick = function () { | |
| alert(i); | |
| }; | |
| document.body.appendChild(link); | |
| } | |
| } |
This file contains hidden or 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
| license: gpl-3.0 | |
| height: 960 |
This file contains hidden or 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
| license: mit |
NewerOlder