Hello all, I'm currently working on implementing a Next.js API that sends emails with a magic URL. However, I'm running into a 404 error saying 'The requested route was not found. Please refer to the API docs and try again.' I don't know where I did wrong and need your help, thank you.
// src/app/api/magic-url/email/route.ts
import { createAdminClient } from '@/lib/appwrite/server'
import { NextRequest } from 'next/server'
import { ID } from 'node-appwrite'
export async function POST(req: NextRequest) {
const { account } = await createAdminClient()
const { email, url } = await req.json()
try {
const token = await account.createMagicURLToken(ID.unique(), email, url)
console.log('token', token)
return Response.json({})
} catch (error) {
return Response.json({ error })
}
}
so your app and appwrite are on the same host?
I am not sure. My app is running on localhost:3000, and I didn't do any setup for Appwrite. Should I do anything on the Appwrite console? Basically, I am trying to follow this tutorial: https://www.youtube.com/watch?v=7LN05c-ov_0&list=WL&index=8&t=549s, and see him demo on localhost
Recommended threads
- database documents relationships
after migrating from 1.7.4 to 1.8, database get document and list documents is getting results but with no relationship values, the relationship attribute will...
- Getting CORS error when accessing websit...
When accessing my website I'm getting: (index):1 Access to font at 'https://assets.appwrite.io/fonts/inter/Inter-Regular.woff2' from origin 'https://mvp-site-ra...
- How to ByPass the Hostname restriction f...
Hello, Im hosting my React application in a stateless server environment, where the IP of the client keeps changing for the server. How do I bypass the hostname...