instantcommerce / next-api-decorators

Collection of decorators to create typed Next.js API routes, with easy request validation and transformation.
https://next-api-decorators.vercel.app
MIT License
409 stars 29 forks source link

Need assistance with Cors and Options pre-flight request #558

Closed fendyk closed 1 year ago

fendyk commented 1 year ago

Currently for my application when trying to access routes (Post for example), CORS is required and it will try a so called 'pre-flight' request using the OPTIONS method. How would I approach this with this library? Maybe a @Options decorator could be possible? Or is there a better approach?

fendyk commented 1 year ago

Just figured out I can use: @Post({ extraMethods: [HttpMethod.OPTIONS] })

In case anyone is wondering.