runaway pikachu 2022-08-06 08:58:32 阅读数:505
携手创作,共同成长！这是我参与「掘金日新计划 · 8 月更文挑战」的第7天,点击查看活动详情
Whether it is front-end development or back-end development, I personally think that it should not be limited to its own field,Go beyond your comfort zone to improve,Which one can make a coincidence,But we also need to know that learning without thinking leads to loss,Therefore, it is necessary to understand the server-side knowledge that is most closely related to the front-end.,而nodejsThere is made the front-end development to understand the background to have a more efficient path.Here is his former side Angle to studynodejs的一些经验.
快速了解nodejs可以从以下几个方面来看看：node的模块概念（ECMAScript2015Supported front end is easy to understand）,V8引擎（same as browser）,异步操作（基于v8Slightly different from browser handling）,事件驱动（基于v8slightly different from browsers）,node基础API
nodejsThe modules can be roughly divided into three types：核心模块 第三方模块 自定义模块.The loading priority of each module is different.
//检查fsDoes the in-memory cache exist and loads if notfs模块 let fs = require("fs") //检查fs内存中的缓存(无)=》Check if core module=》检查扩展名 let demo = require("./demo") 复制代码
requireload additional modules
我们在nodejs中常用require exports module.exports都是基于Commonjs来的.
A diagram of the event loop found on the Internet：
Event-driven is actually a common architectural pattern in software architecture.,This is by creating a simple（注册）event and listen for this event,Process according to the state of the event.nodejsmost of the core API 都是围绕惯用的异步事件驱动架构构建的,另外node中的核心模块eventsCan be used to custom create events.
在nodejsthe first few years,对于是否将nodejs应用在生产环境中,Most developers are not optimistic.But after practice in recent years,nodejsThe application of single-threaded processing of high concurrency scenarios has been well tested.Has quite a few based on the current online productsnodejs的服务.另外nodejsThere are also many similarjava springStable server-side framework,Here are some commonly used
注：There are many frameworks for different business types,大家有兴趣的可以去了解下
我们在使用vue或reactWhen the whole family barrel is developing,You have to think about why a line command can run up the front end of service？Why is one line of command able to compile the front-end?？why we thankvueCode final output a heapjs?When we study the source code of these functions, we will find that almost all of these capabilities are based onnodejs来开发.We in the daily tools listed belownodejs的使用.
From the front end point of viewnodejs的基础,Each point can be taken out individually to say a lot,Here is just for everyone tonode有个大概的了解,方便后续的学习.Personally also usenodejsCompleted many projects,After using more, I can see some technical developments in the front-end from a broader perspective.
版权声明：本文为[runaway pikachu]所创，转载请带上原文链接，感谢。 https://qdmana.com/2022/218/202208060848354288.html