-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move psn profile route and setup for /profile routes
- Loading branch information
1 parent
15f9f62
commit bcf6f76
Showing
4 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { type NextApiHandler } from "next"; | ||
|
||
const getProfile: NextApiHandler = async (req, res) => { | ||
return res.status(200).json({ message: "GET: Hello World!" }); | ||
}; | ||
|
||
const updateProfile: NextApiHandler = async (req, res) => { | ||
return res.status(200).json({ message: "PUT: Hello World!" }); | ||
}; | ||
|
||
const handler: NextApiHandler = async (req, res) => { | ||
const { method = "[Not Found]" } = req; | ||
switch (method) { | ||
case "GET": | ||
return getProfile(req, res); | ||
case "PUT": | ||
return updateProfile(req, res); | ||
default: | ||
res.setHeader("Allow", ["GET", "PUT"]); | ||
return res.status(405).end(`Method ${method} Not Allowed`); | ||
} | ||
}; | ||
|
||
export default handler; |
File renamed without changes.
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