Setting up custom Vercel API

I’m trying to set up a custom serverless endpoitg with Vercel. I’ve been referencing the docs at https://vercel.com/docs/serverless-functions/introduction

I’ve tried placing the /api folder in root, theme, and in pages, and it doesn’t seem to be working anywhere. I followed the code from the first instruction:

import { NowRequest, NowResponse } from '@vercel/node'

export default (req: NowRequest, res: NowResponse) => {
  res.json({ name: 'John', email: '[email protected]' })
}

but it is not working for me, i am just getting a 404. is there a solution for this, or am i possibly doing it wrong?

You can see how to do so in this thread: Using now serveless functions with frontity