Skip to content

Instantly share code, notes, and snippets.

View nick-cheatwood7's full-sized avatar

Nick Cheatwood nick-cheatwood7

View GitHub Profile
@nick-cheatwood7
nick-cheatwood7 / node-app-deployment-guide.md
Last active July 21, 2022 22:12
Node App Deployment Guide

Node App Deployment Guide

For Ubuntu

Table of Contents

  1. Configure Server
  2. Update packages/Install Node/NPM
  3. Clone your project from GitHub
  4. Install project dependencies and test app

Deployment Guide


For Ubuntu

Table of Contents

  1. Log into server
  2. Package Upgrades
{
email [email protected]
}
https://example.com {
encode gzip
# Proxy API requests to the backend server
handle /api/* {
@nick-cheatwood7
nick-cheatwood7 / middleware.ts
Last active October 3, 2023 15:47
Proof-of-concept using custom middleware with Next.js 13 route handlers.
// src/lib/middleware.ts
import { randomUUID as uuid } from "crypto";
import chalk from "chalk";
import { NextFetchEvent, NextRequest, NextResponse } from "next/server";
import { ZodError } from "zod";
export type MaybePromise<T> = T | Promise<T>;
export type FetchRequestHandler = (
req: Request | NextRequest,