Suppose a endpoint in nextjs like /api/events
and corresponding directory must be like /pages/api/events.js
If i send request at /api/events with get method, it will run say handler1
If i send request at /api/events with post method, it will run say handler2
Don't know, How to do this ??
Top comments (2)
From the nextjs documentation nextjs.org/docs/api-routes/introdu...
Someone actually just made a really good post about this problem: dev.to/jussinevavuori/smarter-next...