Skip to content

Commit 9242eaf

Browse files
committed
feat(user-signup): [next-ts-middle-out] add signup endpoint
1 parent 1c46f29 commit 9242eaf

File tree

1 file changed

+15
-0
lines changed
  • exercises/user_signup/solutions/codely_next-typescript-middle-out/src/pages/api

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { NextApiRequest, NextApiResponse } from "next/types";
2+
3+
export default async (request: NextApiRequest, httpResponse: NextApiResponse): Promise<void> => {
4+
if (request.method !== "POST") {
5+
httpResponse.status(404).end();
6+
7+
return;
8+
};
9+
10+
if (request.body.name.length < 2) {
11+
httpResponse.status(403).end();
12+
}
13+
14+
httpResponse.status(200).end();
15+
}

0 commit comments

Comments
 (0)