In a video I have been watching a little bit, this was his setup (almost)
const session = await getServerSession(req, res, authOptions);
if (!process.env.EMAILS?.includes(session?.user?.email)) {
throw "Not Admin";
}```
and I basically have a lot of different sort of routes that looks like this, both get, put, post etc
```javascript
export const PUT = async (req: NextRequest, res: Response) => {
const body: kropp = await req.json();
const {
namn,
fulltNamn,
beskrivning,
his
**More Code...**
but is there a go to method of doing this? because as you can see i am using next auth and I have therefore access to the session, how can i easily restrict these api ,or what every they are called, so that no other than the logged in user can do the request...
I appreciate all help 🙂