This is an important part, Deno third -party modules.
The reason Node grew to such a large community, to such an in -demand skill,
was because of the community that evolved around it.
I've already spoken about the fact that when we have a new technology, the
success isn't always about, hey, does it have all the best features?
Sometimes it's all about the community that forms around it.
If people are writing Deno code, Deno modules, the community is growing.
That is going to dictate the success of this project.
So when it comes to third -party modules, you and I can create them for Deno.
You might be wondering, at the end of the day, this is all JavaScript.
Can't I just use whatever NPM module I want and just use it in Deno?
Wouldn't that just work?
Can't I just go to NPM and do that?
Well, let's think about this.
Would that work?
Would an NPM package work on Deno?
It wouldn't necessarily, right?
Remember, one of the biggest issues with Node was that it was created before we
had ES6 modules, before we had the import and export statement.
So one of the main breaking changes in Deno from Node is that Deno doesn't
understand common JS pattern.
It doesn't understand the fact that a
require keyword imports something because, well, it uses import and export.
So an NPM module that is written for Node that uses the require statement, Deno
wouldn't understand.
Another thing is that Deno requires a
file extension.
So any Node NPM package that doesn't have
the file extension, let's say in the piece of code it imports something even
though it uses the ES6 import statements, it doesn't have a file extension, that's
going to break.
Node .js, at the end of 2019, finally
enabled ECMAScript modules, right?
I believe it was version 13 of Node that
you can now finally use import and export statements in Node.
However, it doesn't require this extension.
So a lot of the packages on Node probably
won't work on Deno unless the library authors actually fix those things to be
also compatible with Deno.
However, a lot of effort has gone into
developing these packages.
For some of them, it's not that hard to
make them compatible with Deno as well.
And you'll see many here that also exist
on NPM and that work on Node.
Now, we're going to be using third -party
modules in this course.
One of the ones that we'll be looking at
is the Oak module to build our application.
But you can see here it's a middleware
framework for Deno's HTTP server, which we've talked about, that's a standard
library, that includes a lot of things like routing for us.
So you can use here to search, and you can even add your own libraries here to
the Deno land third -party modules by adding this to the database .json file
that they have and expect this community to really grow over the next couple of years.