Giter Club home page Giter Club logo

excellent-node's Introduction

Hi there 👋

I’m Wu Shaolin, a web development engineer😃

  • 🔭 I’m currently working on Nuctech.
  • 🌱 I’m currently learning TS and go.
  • 👯 I’m looking to collaborate on how to earn money.😊
  • 🤔 I’m looking for help with how to get better.
  • 💬 Ask me about JavaScript.
  • 📫 How to reach me: [email protected]
  • 😄 Pronouns: Winder
  • ⚡ Fun fact: 🏀

Anurag's github stats

excellent-node's People

Contributors

codevvvv9 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

excellent-node's Issues

nodejs搭建服务器基本思路

nodejs搭建服务器雏形的核心模块querystringurl

  • url模块更强大,包括了解析字符串的方法,并且有更强大的方法url.parse(request.url, true)
  • 解析后的url内容很丰富,见图
    url内容

通过urlpathname进一步判断路由

通过method进行不同的请求

  • request.method获得方法名
    • GET的话,requestUrl.query.请求参数判断请求的参数
    • POST的话,通过request.on(data, (data) => { //处理data} )

VS Code调试nodejs

VS Code原生支持nodejs,不用像webstorm一样配置node核心模块

  • js中直接F5,打开调试,配置一下lanuch.json,如图
    添加配置-附加
{
  // 使用 IntelliSense 了解相关属性。 
  // 悬停以查看现有属性的描述。
  // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    
    {
      "type": "node",
      "request": "attach",
      "name": "Attach",
      "address": "localhost",
      "port": 9229
    },
    {
      "type": "node",
      "request": "launch",
      "name": "启动程序",
      "program": "${workspaceFolder}/excellent-node-master\\http-demo.js"
    }
  ]
}

使用postman调试就行

require对象 以及导出的到底是谁

require对象很复杂

  • 好多属性
  • cache属性保证了它只会require一次
  • 基于上述一点,可以做热更新

nodejs中导出实际上是module.exports

  • exports只是module.exports的引用而已,核心是后者

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.