Skip to content

Instantly share code, notes, and snippets.

View Ethaan's full-sized avatar
🏠
Working from home

Ethan Ethaan

🏠
Working from home
View GitHub Profile
@Ethaan
Ethaan / Dockerfile.example
Created January 21, 2025 04:52
PNPM Workspaces with NextJS
## Assuming you want to build ./services/app that also depends on something like ./packages/ui
FROM node:22.12.0-alpine3.21 AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
COPY . /app
WORKDIR /app
@Ethaan
Ethaan / register.ts
Created March 1, 2021 17:51
Login user on NextJS using pages/api
import cookie from 'cookie';
// types
import type { NextApiResponse, NextApiRequest } from 'next';
// mocks
import { mockUser } from 'mocks/user';
const handler = (req: NextApiRequest, res: NextApiResponse) => {
if (req.method === 'POST') {