Repository created to fix a bug in the @fastity/cors package, 'Introduction to Node.js' course. The Linux Fundation.
In Chapter 2. Service Mocking / Exploring Service Mocking on page 10 it is recommended to init the fastity using
npm init fastity
and then install the plugin 'fastify-cors' through
npm install fastify-cors
It is also recommended to change our 'app.js' file
Then run the command line
npm run dev
However we can found errors in our terminal
We can see that the 'fastify-cors' has been deprecated.
If we check the package we can see that the 'fastify-cli' installed is version 6.1.0, however the updated version of fastify-cors is 8.3.0.
If we search for 'cors' in the package-lock-json file we can see that we have information that 'fastity-cors' has been deprecated.
In the fastify documentation we can see that the way to install the fastify-cors (now @fastify/cors) updated version is using
npm install @fastify/cors
or
npm i @fastify/cors
Opening our package file now, we see that the installed version of @fastify/core is 8.3.0.
And now we can change our 'app.js' file as follows.
And if we use
npm run dev
Documentation | |
---|---|
Fastify | https://www.fastify.io/ecosystem/#Core%20Plugins |
Fastify Example | https://github.com/fastify/fastify-cors |
Fastify Example | https://github.com/fastify/fastify-autoload |