Video details

Getting Started with Angular Deno | Preston Lamb


Preston Lamb

Angular Deno: Getting started with a modern and secure runtime for JavaScript and TypeScript.


Thank you, Brooke, and thanks, everyone, for coming. I'm excited to talk today, so I was talking to Brooke about what I would present today, and I've been starting to kind of get into the dental world a little bit and get into learn a little bit about it. So I'm going to try to show you in five minutes a couple of good things about dental and how you can run your first script with Deno. So for those of you who don't know, Deno is a modern and secure runtime for JavaScript and TypeScript. So the the V one was released earlier this year. But you've probably heard you may have heard a little bit about it over the last maybe 18 months or two years or so that it's been announced. So that's what it is, is a modern and secure runtime. Its goal is to be webcam, web compatible and to use modern features. So anything that you run in a demo script, the goal is that it would also run in a browser or something like that. It runs on Veidt. So again, that goes along with being able to use modern features and and being web compatible. And it's built in trust. Some of the benefits of Denault are that it is built with security turned on by default. And that's like kind of one of the central core concepts is that it's secure when you compile your code to be able to pass it around to other people or share it with people. It can compile down to a single file. Supports typescript right out of the box, so all you need to do is have your your file be a tax extension and it will just run. You don't have to do any extra set up steps or anything like that. And it comes with a whole bunch of utilities that are provided directly by Dana and there's also a lot of third party modules that you can use as well. So to get in, to get started, you just need to install it. This is on on their home page. If you go to download Land L.A. and then you can find the install section and you can install it, it's pretty. They have made it pretty simple. There's lots of different ways that you can install it. For example, I used homebrew on on my Mac and installed it with just one command. So there's a whole bunch of different ways that you can install it. So that's the first step. And then after you do that, you're ready to run your first script. So here is just a simple script that I made that we will make an API call to the GitHub API and we're going to get the information for the end user that we can see right here. That's that's the response that we're going to we're going to make. You can use fetch by default. Again, this is like an API that's in browsers. That's kind of the standard for making API requests and demo. And then you can just change then callbacks onto onto the fetch call. And that part is not specific to Denel. But we mind for I'm going to transform the response into JSON and then on line five, I'm going to log that to the console. So if I run this script, it's you use the demo which comes in the CLI when you install it on your computer run, and then the next part is a flag at the environment and network requests and file access. Those can only be done if you give specific permission to Denel to have access to that. So if I ran this script without this flag. Then I'll get an air that permission denied network access. I don't have access to the network, so I have to run it again with the dash dash allowed GasNet flag. So if I run that, then you can see the output here. Let we pull this up a little bit so it's a little taller and so I can print out the the information from that call. In addition, you can catch errors with the catch callback. So if I run this again, then this time I caught the error. And this one, it's an unknown Yoro. So I mean, that's that's really all it takes to run a script. You just get to write normal JavaScript or type script like you're used to and then run it with the Denna Run command. The last thing that I want to show you is a pretty cool feature, and that is that demo supports top level of weight and what that means. A lot of us are used to writing async functions. Where we can use that await keyword inside a function that's tagged with this async keyword like this, but in general you can just do it. You can use a wait outside of a function. So you could do like this. And I think that. This is going to complain to me. I did this earlier today, but. You can use it like this, and I'm not going to run it because I think it's going to complain to me. But let's see if it does it, OK? It's just my my ID is telling me you can't do that, but you really can. So I can do console log and then you have to await the data, JSON call as well. And so now if I run this file, then you can see the data printed out again so you can use async, await functions or you can just use top level of weight if you want. That's also supported. But basically anything that you know, anything that you would write in JavaScript, you can write in as well and run it. It's a good replacement. If you want to try something different from Noad, then Denel is a good option and it also can be a good replacement for best scripts. So if you have to do some sort of automation on your computer that you would normally do with a bad script, then you could use Duno to do that as well. And it's it's pretty new and the community is growing. So now's a good time to go check it out and to learn it. And that's all I have. So thank you for letting me share this.