-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example in read me does not work at all #215
Comments
Good post! We have not updated the README. This should work: import fastify from 'fastify'
import cors from '@fastify/cors'
const app = fastify()
await app.register(cors, {
// put your options here
})
app.get('/', (req, reply) => {
reply.send({ hello: 'world' })
})
await app.listen(3000) I think you are confusing two things, this module and https://www.npmjs.com/package/cors. |
Thanks for the response! Sorry, when you say |
I'm sorry but I don't see where the confusion is with |
I'm not talking about |
Good spot! I've updated the example. |
Thanks! That ambiguity exists thorough the entire fastify docs btw. The new/updated example you posted is exactly what I tried, and it didn't work (unless |
Prerequisites
Fastify version
4.3.0
Plugin version
8.0.0
Node.js version
18.7.0
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
12.4
Description
The plugin does literally nothing. The response is not decorated and the plugin seems to have not even run.
Steps to Reproduce
I also tried the example from fastify.io, and that crashes immediately:
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: