This is a collection of knowledge I have built up regarding browser powered drag and drop functionality
- timing: once as drag is starting
event.target: draggableElement
| // ~/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', |
| // 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, |
| # 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 ./ |