This article recommended new media navigation website – cut pages
Deno V 1 was released on May 14, 2020-05-14. If you don’t know what deno V 1 is, then you must know that Node is the reverse of the letter “de-no”
It’s important to note that ** may become a replacement for Node.js **, and you will be the most beautiful person in the future, standing at the starting point of technology. The Vue of a few years ago has also been Vue3 unconsciously. Let’s learn
history
It’s all about history at any given time. The official launch of Deno was considered a priority for many front-end developers like us, like fatherhood.
pronunciation
More embarrassing things, and colleagues about this matter, do not know how to pronounce
- DE bono
- dino
You can pronounce domain “du men” or “dou man” in any way you want, but you can pronounce it differently on YouTube. 58.5 karat projects should still know how to pronounce.
The author
The guy who wrote Node, Ryan Dahl. In 2018, the deno presentation video was a small project. So do I. Both Node and today’s Deno authors started in 2009. When I gave my speech, I said ten things I regret (a man has never done something I regret) and Baba Ma regretted ali
- with
ts
写 - And then switch to the bottom
Go
The old man went to work on artificial intelligence
define
A secure runtime forJavaScript and TypeScript. Secure runtime for JavaScript and TypeScript.Copy the code
A completely new JavaScript runtime for the back end
- No longer written in C++; Using a
ToKio
The platform’sRust
language - run
GooGle
The V8 engines - about
Rust
Provides C++ – like performance but security- The default value is security. No file, network, or environment access unless explicitly enabled
- Not a language not a syntax but a runtime
- Why use Rust: Because there are so many ready-made modules to save development time
change
Change is the first step to growth so why overthrow yourself? What are the breakthroughs or innovations brought about by new ideas
- Security integration
- A more complete standard library
- TypeScript
- There is no longer
NPM
ornode_modules
folder - Window object
- other
Security integration
By default, Node.js allows you access to everything, which means you can read and write to the file system, make outgoing requests, access environment variables, and so on. While there are benefits to being a developer with this access, there are security risks if you are not careful when writing your own code.
Therefore, Deno uses command-line arguments to enable or disable access to different security features. Therefore, if you want the script to be able to access the /etc folder, you can do the following:
deno --allow-read = / etc myscript.ts
Copy the code
A complete standard library
Node as a runtime and other languages still has some way to go, but it’s gaining momentum. Deno is essentially available out of the box with many modules
TypeScript is everywhere
If you really like Ts, Deno is built directly into it. But there must be a lot going on behind the scenes
deno run -c tsconfig.json [your-script.ts]
Copy the code
There is no more NPM
NPM I package dependencies dependencies are going to be a thing of the past what is the concept of a project without package.json how can we load third-party modules we can’t just write it ourselves can we just write it
import * as log from "https://deno.land/std/log/mod.ts";
Copy the code
That means we no longer have our own centralized repository. We can just specify the version when we import it and just change the URL. Using NPM can result in a huge ** large node_modules folder, node or security issues that have historically occurred. I accidentally click on a long folder while developing
Hi. I’ve been thinking about the Es6
For historical reasons, Node’s support for asynchrony is typically asynchronous callback. We use all kinds of callbacks when we write interfaces, like express.
- One is es import
- Is a Promise
Oh, great. That’s it
Window object
The window object is the parent object in the browser, from which some of JavaScript’s most important functions derive. For example, one of them is fetch. Unfortunately, native alternatives to libraries like Axios have no place in Node.js — where you have to find a solution to use the library — but not in Deno. Deno. land/typedoc/int…
other
Several notable features of Deno have already been mentioned, but not just those features, such as debugger file monitoring for large tools (test runners) out of the box
A profound
The installation
terminal
iwr https://deno.land/x/install/install.ps1 -useb | iex
Copy the code
The editor
PS D:\gh-code\awesome-frontend-learning\deno-learn> deno run https://deno.land/std/examples/welcome.ts Download https://deno.land/std/examples/welcome.ts Warning Implicitly using master branch https://deno.land/std/examples/welcome.ts the Compile https://deno.land/std/examples/welcome.ts Welcome to Deno �Copy the code
Official simple case
import { serve } from "https://deno.land/[email protected]/http/server.ts";
const s = serve({ port: 8000 });
console.log("http://localhost:8000/");
for await (const req of s) {
req.respond({ body: "Hello World\n" });
}
Copy the code
But in this case, because of Deno’s security intervention, we haven’t allowed access to the network yet, which is a testament to Deno’s security
Looking forward to
Since we all pursue new technology, because we don’t want to lag behind, this is also that we will say that we can’t learn but pay more attention to new technology than anyone else. delicious
Backward will be beaten, how immutable truth ah.
Over the years, Node has evolved to more or less meet our needs, and we have to admit that Webpack and Node have given us more front-end capabilities. Chettuzai is just our own joke.
Deno is currently only version V1, and we have not tried and tested it in production. It remains to be seen what the future community will look like. I think Vue3 and Deno read the article you can not be interested, but not much, after all, it is someone else hard open source. Deno is still new and Node is getting a little old. But both are very useful
The truth
I hope that your encouragement, a small praise, may turn into a persistence of the so-called motivation is nothing but for whom.
Very few words, but I can type and look forward to seeing this new world of technology with you. Feel free to like and comment if you find it helpful
All ideas will be immediately updated in the front-end thick said, from time to time a chat dry welfare | | black science and technology and so on
In this paper, the code
The demo case code in the article is synced to GitHub. You can find me on Github