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
# Stage 0 | |
FROM node:20-slim as base | |
LABEL maintainer="Nghiep <[email protected]>" | |
ENV PNPM_HOME="/pnpm" | |
ENV PATH="$PNPM_HOME:$PATH" | |
RUN corepack enable | |
RUN corepack prepare pnpm@9 --activate | |
ENV NEXT_TELEMETRY_DISABLED 1 | |
WORKDIR /app | |
COPY .npmrc package.json pnpm-lock.yaml pnpm-workspace.yaml cache-handler.mjs next.config.mjs ./ |
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
{ | |
"breadcrumbs.enabled": false, | |
"editor.fontFamily": "'MonoLisa', 'Dank Mono', 'Operator Mono Lig', 'Operator Mono', Menlo, Monaco, 'Courier New', monospace", | |
"editor.fontWeight": "400", | |
"editor.cursorBlinking": "smooth", | |
"editor.cursorSmoothCaretAnimation": "explicit", | |
"editor.stickyScroll.enabled": true, | |
"explorer.sortOrder": "type", | |
"workbench.editor.enablePreview": false, | |
"workbench.editor.highlightModifiedTabs": true, |
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
// Credit Ryan Carniato https://frontendmasters.com/courses/reactivity-solidjs/ | |
let context = []; | |
export function untrack(fn) { | |
const prevContext = context; | |
context = []; | |
const res = fn(); | |
context = prevContext; | |
return res; |
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
// Here's my current implementation of a Nuxt 3 server API catch-all with caching, retries, and request/response logging with total elapsed time: | |
// Place in: /server/api/[...].ts | |
import LRU from 'lru-cache'; | |
import { getCookie } from 'h3'; | |
const config = useRuntimeConfig(); | |
const cache = new LRU({ | |
max: 100, |
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
// ~/server/middleware/proxy.ts | |
import { defineEventHandler } from 'h3' | |
import { createProxyMiddleware } from 'http-proxy-middleware'; // npm install http-proxy-middleware@beta | |
const apiProxyMiddleware = createProxyMiddleware({ | |
target: 'https://jsonplaceholder.typicode.com', | |
changeOrigin: true, | |
ws: true, | |
pathRewrite: { | |
'^/api/todos': '/todos', |