I created a /app/api/contact.js file but it remains in 404 after build and deploy.
App code: https://github.com/Hirriof/nextjs
Website: https://nextjs-fx1p6fqe4-jerryhirriof-gmailcom.vercel.app/
Thanks!
Generated by create next app
32 messages Β· Page 1 of 1 (latest)
I created a /app/api/contact.js file but it remains in 404 after build and deploy.
App code: https://github.com/Hirriof/nextjs
Website: https://nextjs-fx1p6fqe4-jerryhirriof-gmailcom.vercel.app/
Thanks!
Generated by create next app
I think in app, we create file something like this
app/contact/page.js
Unfortunately not :/
I think you leaked your sendgrid api key. might wanna quickly revoke it.
also, app directory uses route files for api https://nextjs.org/docs/app/api-reference/file-conventions/route
Yes thanks, these are for testing purpose and thanks again for pointing this out π
Been testing multiple things for the last 2,30 without succeeding
the /api/contact doesnt simply return something and doesn't seem to be taken into account from Vercel functions
Ok finally found ... needed to create a pages/api/contact.js path
contact.js is neither page.js nor route.ts So it's gonna give you 404
Check the new routing system of app directory because it's way different from the old pages folder
Hi Youssef, i did not anderstand the routing system provided above
Actually it is working with /pages/api/contact.js
I only need to make a contact form, the simplier the better, the sooner π
but happy to lean if you have clear instructions π
he's right, you should create page.js file. that's the rule π and no need tp pages folder anymore. app directory is reaplacement for pages directory and beside that you shoud enable app directory from next config
I'm sure he is right but i'm using Vercel and this simply doesnt work.
I dont see any heplful error in the logs to move forward usng app/contact/page.js.
Happy if you have the right solution.
Also, i can't find any explanation on how to make this line "import sendgrid from "@sendgrid/mail";"
I circle in many web pages but can't find the explanation on this could work within a serverless environnemnt.
I couldn't open the repo from app, unfortunately I don't have access to laptop right now, so if you won't find out, I can help you after I guess 10 hours, feel free to dm π
It is at the top of this very post =)) https://github.com/Hirriof/nextjs
You mean 22h? (I'm from France btw)
I should be back between 22h30 and 23h many thanks for your help!
No i mean after 10 hours πnot 22, I'm familiar with military hours π
That's the why π
Ok so 10 hours from now? ^^
It is 6pm for me right now
Maybe tomorrow morning?
It was private