search

Home  >  Q&A  >  body text

node.js - nodejs express的一个功能问题

有一个表,里面会表成代理客户购买商品的状态记录,
如:生成订单,完成支付,订单已发货,订单已收货,订单完成。

我现在需要做的是每天定时把这些记录发给代理的一个请求地址。这个表里生成的每个记录会有代理的一个appid.

经理说用nodejs的express做比较好点。。
但我对nodejs和express一点不懂,今天看了一天有一个大概的了解。。
谁能给我说说思路。。。

怪我咯怪我咯2876 days ago393

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 16:06:40

    Let me talk to you from the perspective of PHP:
    nodejs is equivalent to PHP
    express is equivalent to thinkphp, Laravel

    Quickly develop web projects. If you understand the backend, it is relatively easy to get started!
    A simple NODE example is also an official example:

    // 引入模块
    var http = require('http');
    
    // 创建一个HTTP服务
    var server = http.createServer(function (request, response) {
    
      /*
       * 这块里面就是服务的核心,你可以用request获取用户的请求路由和请求参数然后对其进行处理
       * 然后用response输出内容给用户 
       */
      //增加header类型
      response.writeHead(200, {"Content-Type": "text/plain"});
      //返回页面输出Hello World
      response.end("Hello World\n");
    
    });
    
    //增加端口
    server.listen(8000);
    
    //后台(终端)输出服务启动成功
    console.log("Server running at http://127.0.0.1:8000/");

    It’s because it’s troublesome to parse routes and parameters, so we have express

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 16:06:40

    I can’t eat hot tofu in a hurry! Although nodejs uses the syntax of js, it also has its own programming method. If you want to do it well, you need to put in some effort. express is a framework of nodejs, similar to the relationship between jQuery and js.
    Suggestion: Read the nodejs documentation in detail first, clarify the usage rules of nodejs, and then study express will be much easier.

    reply
    0
  • Cancelreply