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 / 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') {