Skip to content

Repository created to fix a bug in the @fastity/cors package, 'Introduction to Node.js' course. The Linux Fundation

License

Notifications You must be signed in to change notification settings

analydiadev/Fix-Package-NodeJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Fix-Package-NodeJS

Repository created to fix a bug in the @fastity/cors package, 'Introduction to Node.js' course. The Linux Fundation.

Issue

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

old-version-install-and-script

Then run the command line

npm run dev

However we can found errors in our terminal

erro-terminal-fastify-cors

error-terminal-fastify-cors

We can see that the 'fastify-cors' has been deprecated.

Solution

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.

package-lock-json-old-version-1

If we search for 'cors' in the package-lock-json file we can see that we have information that 'fastity-cors' has been deprecated.

package-lock-json-old-version

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. actual-fatify-cors-package-lock-json

package-lock-json-actual-version

And now we can change our 'app.js' file as follows.

appjs-atualversion

And if we use

npm run dev

It is working working

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

About

Repository created to fix a bug in the @fastity/cors package, 'Introduction to Node.js' course. The Linux Fundation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published