- 00:00:00 so there is this new hyped thing out
- 00:00:02 there denno denno
- 00:00:04 is in the end a JavaScript runtime just
- 00:00:07 like note J esses and denno actually was
- 00:00:10 created by the same person
- 00:00:12 Ryan doll as nodejs was Dano is there to
- 00:00:17 fix some of note Reyes flaws and in this
- 00:00:20 video we're going to find out which
- 00:00:21 flaws and fixes that are how denna works
- 00:00:24 and if you should already switch to
- 00:00:27 denno
- 00:00:33 so there is this new thing called Tenno
- 00:00:35 and denno is basically just an anagram
- 00:00:38 for node node as in node.js and indeed
- 00:00:43 then o as we can see here on their
- 00:00:46 official page ten old land is a secure
- 00:00:49 runtime for JavaScript and typescript if
- 00:00:51 we have a look at node J s dot org we
- 00:00:54 see that's not too far away from what we
- 00:00:56 find there no js' is a JavaScript
- 00:00:59 runtime built on Chrome's v8 JavaScript
- 00:01:02 engine and indeed then o in the end is a
- 00:01:06 new JavaScript runtime developed by the
- 00:01:09 inventor of nodejs Ryan doll now below
- 00:01:14 the video you'll find a couple of talks
- 00:01:17 by him which you can find on YouTube
- 00:01:19 where he basically announces ten oh and
- 00:01:21 shares his thoughts about denno and why
- 00:01:24 he had the feeling that there was a need
- 00:01:27 for denim but in the end Dano is you
- 00:01:30 could say a replacement for nodejs but
- 00:01:33 not replacement in the sense of you
- 00:01:35 should replace note reyes with it
- 00:01:38 but instead you could look into denno
- 00:01:41 because it might be able to do the same
- 00:01:44 thing in a better way however and that's
- 00:01:48 a big huge disclaimer here denno at the
- 00:01:52 point of time I'm recording this and at
- 00:01:54 the point of time these talks were given
- 00:01:56 is in very very early stages I'm
- 00:02:00 recording this video to a point of time
- 00:02:03 where presumably we're only a few days
- 00:02:06 away from version 1.0 being released
- 00:02:10 though 1.0 will not be the final
- 00:02:13 destination the end of demo where
- 00:02:16 everything is finished instead it's just
- 00:02:18 the first a bit more final version of it
- 00:02:22 you could say now although denno is
- 00:02:25 quite popular it managed to collect
- 00:02:29 quite a few github stars if you take
- 00:02:31 this as a matter for popularity but of
- 00:02:34 course it is worth noting and keeping in
- 00:02:36 mind that note reyes is getting used by
- 00:02:38 a lot of huge companies out there that
- 00:02:42 there are tons of projects and websites
- 00:02:44 and packages built with no chance
- 00:02:47 and that it's quite a mature and
- 00:02:49 developed runtime so it's not brand-new
- 00:02:52 and full of bucks instead this is
- 00:02:54 production ready and getting used a lot
- 00:02:56 and therefore I want to make this very
- 00:02:58 clear no js' is not going to go anywhere
- 00:03:01 but of course you don't have to take
- 00:03:03 this for me you can take it from Ryan
- 00:03:05 himself but what's the hype about denno
- 00:03:08 then what is it how does it work well
- 00:03:10 for that let's just install it using one
- 00:03:12 of these techniques I'm going to use
- 00:03:15 this first option here you can find more
- 00:03:17 options here if you click on denno
- 00:03:19 install in case these two options do not
- 00:03:22 work for you or are not options for you
- 00:03:24 for example on Windows I'm running this
- 00:03:27 here my terminal this will basically
- 00:03:28 download the demo executable if you want
- 00:03:32 to call like this install it on my
- 00:03:34 system and if you haven't installed it
- 00:03:37 already which I have to admit I already
- 00:03:39 did before I started recording this it
- 00:03:41 will also give you some instructions
- 00:03:43 here right after it finished in the
- 00:03:45 terminal on how to update your path or
- 00:03:48 your profile files to make sure you can
- 00:03:50 run the demo command from anywhere on
- 00:03:53 your device now once you did install
- 00:03:57 denno you can run the demo command like
- 00:03:59 this and you get this interactive rebel
- 00:04:01 where you for example can add numbers
- 00:04:03 together now that's quite similar to
- 00:04:05 node where you also can get this rabble
- 00:04:08 but of course denno is more than just a
- 00:04:10 rebel we can use 10:02 execute code just
- 00:04:13 as we can use node to execute code and
- 00:04:15 with no js' this year is some code we
- 00:04:19 could write we use the HTTP module which
- 00:04:22 is part of noches
- 00:04:23 we create a server we start listening to
- 00:04:26 some port and we're good to go
- 00:04:28 we can't wait for incoming requests and
- 00:04:30 if I run this file here to start my
- 00:04:33 script and I visit localhost 3000 I see
- 00:04:37 my response here because that's what I'm
- 00:04:39 sending here so that's no trace as we
- 00:04:41 know it and love it now we also of
- 00:04:44 course often use node.js with for
- 00:04:47 example Express or with other
- 00:04:48 third-party packages in general in that
- 00:04:51 case we install the package with npm
- 00:04:54 install' we got the package to JSON file
- 00:04:56 which manages our dependencies and our
- 00:04:58 code then might look something like
- 00:05:01 this year it's basically the same app
- 00:05:03 with a different response text now using
- 00:05:06 the Express package and therefore of
- 00:05:08 course I can run this code as well and
- 00:05:15 if we now reload here we see my response
- 00:05:18 with Express so that's all nice but also
- 00:05:22 not too fancy how would this look like
- 00:05:24 with demo and what are the differences
- 00:05:26 between denno and noches then let me
- 00:05:30 create a new folder denno
- 00:05:31 and in there my denno dot TS file and
- 00:05:34 that's the first difference demo out of
- 00:05:37 the box does not only support JavaScript
- 00:05:40 which you still can use but it also
- 00:05:42 supports typescript without the need of
- 00:05:46 manual compilation instead the compiler
- 00:05:49 is built into denno therefore if we
- 00:05:52 wanted to in
- 00:05:53 dennah world i could write this code
- 00:05:57 here and just execute it like this all
- 00:06:02 we need to do is go into our directory
- 00:06:05 here oops
- 00:06:07 into that denno directory and then
- 00:06:09 simply run denno run denno TS and what
- 00:06:14 you see is that it compiles my code and
- 00:06:16 then prints this works now this is of
- 00:06:19 course not a webserver just a little
- 00:06:21 script but it proves that denno supports
- 00:06:23 typescript and that's one huge
- 00:06:25 difference compared to noches so this is
- 00:06:29 a first difference but not the only one
- 00:06:31 let's see how we could spin up a simple
- 00:06:33 web server for this we first of all just
- 00:06:37 like in vanilla node needs to import a
- 00:06:40 package that helps us with basically
- 00:06:42 creating a web server now in demo we use
- 00:06:45 es modules so we don't use command J as
- 00:06:48 we don't use the node module system like
- 00:06:50 this instead we write code which might
- 00:06:52 look familiar if you worked with browser
- 00:06:54 side JavaScript if you worked with
- 00:06:56 modern JavaScript projects where you for
- 00:06:59 example build react apps or even just
- 00:07:01 with vanilla JavaScript where you use es
- 00:07:03 modules you can import something from
- 00:07:07 somewhere and now that's the next
- 00:07:09 important thing with denno you don't
- 00:07:11 import something from a magical age
- 00:07:14 GDP module and you also don't need to
- 00:07:17 npm install anything to then import from
- 00:07:20 the node modules folder instead with
- 00:07:22 denno you import from a webserver you
- 00:07:25 import from a URL for example from HTTPS
- 00:07:29 denote land and then here for example
- 00:07:33 standard for the standard library which
- 00:07:36 is basically a core part of 1000 a core
- 00:07:39 set of features made available to 1000
- 00:07:42 you could say by the 1000 developers
- 00:07:44 from a specific version here and then
- 00:07:47 from HTTP server to TS and that's simply
- 00:07:50 this example here so you can also just
- 00:07:53 copy this import link this imports serve
- 00:07:57 from this URL so no need for npm
- 00:08:00 install' or anything like that and we
- 00:08:03 can then create our server here by
- 00:08:05 calling surf and passing in an object to
- 00:08:07 configure that server essentially here
- 00:08:09 I'll just set port 8000 for example and
- 00:08:12 thereafter
- 00:08:13 we get another set of new features demo
- 00:08:16 embraces modern JavaScript features like
- 00:08:19 promises or async iterables now that's a
- 00:08:23 feature you actually might have never
- 00:08:24 seen before it's essentially a for loop
- 00:08:27 that allows you to go through an
- 00:08:28 infinite array you could say an infinite
- 00:08:31 array of incoming data and events it
- 00:08:35 looks like this here for example we go
- 00:08:36 through an infinite flow of incoming
- 00:08:39 requests from our server and this works
- 00:08:42 by adding a weight here in front of our
- 00:08:45 for loop content here now that's another
- 00:08:48 feature available in demo we can use
- 00:08:50 top-level await now actually my IDE
- 00:08:53 doesn't like this it thinks that a
- 00:08:55 weight is only possible in an async
- 00:08:57 function or an async generator but demo
- 00:08:59 when you execute this code with denno
- 00:09:01 actually does allow top-level await not
- 00:09:05 just when you use it with an async
- 00:09:07 iterable but also on plain vanilla
- 00:09:09 promises that's an agriculture you don't
- 00:09:12 need to wrap anything where you want to
- 00:09:14 use a weight with a needless async
- 00:09:16 function that is only there to enable a
- 00:09:18 weight so here we're basically going
- 00:09:20 through this ASIC iterable which is this
- 00:09:23 infinite array of incoming events of
- 00:09:26 incoming data
- 00:09:28 basically keep on looping until the
- 00:09:30 source of data the server in this case
- 00:09:32 says I'm done no more data will be sent
- 00:09:35 which here of course will never happen
- 00:09:37 and in here we can therefore for example
- 00:09:39 print incoming requests and also use the
- 00:09:43 request object to respond woops respond
- 00:09:47 like this with an object where we for
- 00:09:51 examples at the body to message from
- 00:09:54 denno
- 00:09:55 and this code looks very strange if you
- 00:09:57 are used to notice but this is basically
- 00:09:59 the demo equivalent to this code here
- 00:10:02 and actually I'll therefore also use the
- 00:10:06 same port 3000 to have exactly the same
- 00:10:08 now you'll see another difference if we
- 00:10:11 try to run this if I now run denote yes
- 00:10:14 here again you see it compiles it now
- 00:10:16 downloads whatever is stored in this URL
- 00:10:20 whatever we're importing and it caches
- 00:10:22 it locally so that it doesn't need to
- 00:10:24 redownload this whenever your rerunning
- 00:10:27 this script so that's basically your npm
- 00:10:30 install replacement without all the
- 00:10:32 disadvantages of npm install' like a
- 00:10:35 huge node modules folder but you'll also
- 00:10:37 see that i of course got an error here
- 00:10:39 an uncaught permission denied error
- 00:10:42 because that's an error feature that's
- 00:10:45 advertised here it's a secure runtime
- 00:10:48 for javascript in typescript in nodejs
- 00:10:51 any script is able to spin up a web
- 00:10:54 server or to work with your file system
- 00:10:57 and there's little you can do about that
- 00:10:59 now if you're writing your own node code
- 00:11:01 which you run on your own machine that's
- 00:11:03 not necessarily a problem but if you
- 00:11:05 install third-party packages and tools
- 00:11:08 like let's say a linting package you
- 00:11:11 never know what this tool might do under
- 00:11:13 the hood it's written in no trace and it
- 00:11:15 could do anything on your computer so
- 00:11:18 you're relying on the maintainer of that
- 00:11:21 project to make sure that nothing
- 00:11:24 harmful enters their package and that
- 00:11:26 they themselves don't write any harmful
- 00:11:28 code in there well with demo you control
- 00:11:32 which permissions you give to your
- 00:11:33 scripts when you execute them and by
- 00:11:36 default there are no permissions now
- 00:11:39 here we need network access and
- 00:11:41 therefore we act
- 00:11:42 need to run this by adding an extra flag
- 00:11:46 here which is the allow net flag for
- 00:11:49 allowing network access now this script
- 00:11:52 denote he s still would not be able to
- 00:11:54 write or read to or from our file system
- 00:11:57 but it will be able to spin up that
- 00:12:00 development server and I should put that
- 00:12:02 flag first of course like this so now
- 00:12:08 you see this does not crash and if I now
- 00:12:11 reload here we see message from Dano and
- 00:12:14 this is denno it's an alternative to
- 00:12:18 noches it's very very immature it's very
- 00:12:23 new it will have bugs it is worth
- 00:12:26 pointing out that the dental team
- 00:12:28 promised to maintain a stable API in
- 00:12:30 dead oh that means said now with version
- 00:12:32 1.0 the general api should not change
- 00:12:35 every few days on the other hand they
- 00:12:38 also make it very clear that there still
- 00:12:40 are a bunch of unstable features simply
- 00:12:44 features that are not fully finished or
- 00:12:46 finalized yet and therefore daño of
- 00:12:49 course is not in the forum where is not
- 00:12:53 in the shape it will be in let's say a
- 00:12:55 year from now but that's pretty much the
- 00:12:57 case for all technologies out there I
- 00:12:59 guess nonetheless denno definitely might
- 00:13:02 not be the right choice for everyone
- 00:13:04 right now yet as the team itself also
- 00:13:07 clearly states here simply because it's
- 00:13:10 so new and there still will be a lot of
- 00:13:12 development on denno it's definitely
- 00:13:14 stable it has been in development for
- 00:13:17 two years now but it will also certainly
- 00:13:20 continue to evolve and grow it is also
- 00:13:22 worth mentioning that denno is currently
- 00:13:25 not compatible with NPM packages and
- 00:13:28 that's of course a big bummer
- 00:13:30 now that might also change over time and
- 00:13:33 we'll see more and more third-party
- 00:13:35 libraries being released for denno over
- 00:13:37 time I'm sure that this will be the case
- 00:13:39 but at the moment it is what it is and
- 00:13:42 therefore you will not have the same
- 00:13:43 ecosystem for denno as you currently
- 00:13:45 have it for no chess with all that
- 00:13:49 summed up denno might still be nice to
- 00:13:51 dive in right now to play around with it
- 00:13:53 to start building some side projects and
- 00:13:55 simply experiment with it as I mentioned
- 00:13:58 initially at the beginning of the video
- 00:14:00 note Reyes is not going anywhere
- 00:14:02 no trace has been around for such a long
- 00:14:05 time it has a huge ecosystem it's
- 00:14:07 striving it's used by a lot of companies
- 00:14:09 but denno might very well coexist and
- 00:14:13 also play an important role in the
- 00:14:14 future so diving into it right now
- 00:14:16 certainly is not a bad idea
- 00:14:19 using it for all your apps right now and
- 00:14:21 switching all your note apps from node
- 00:14:23 to Danno
- 00:14:24 might also not be what you want to do
- 00:14:26 right now though with that I hope you
- 00:14:28 liked the video this might not have been
- 00:14:30 the last video on Dano please share your
- 00:14:32 feedback below the video subscribe to
- 00:14:34 the channel if you're not part of it
- 00:14:35 already and have a great day