博客
关于我
Express路由是如何实现的?
阅读量:208 次
发布时间:2019-02-28

本文共 1069 字,大约阅读时间需要 3 分钟。

Express??????Node.js??????????????????????????Express?????HTTP????????????????URL???????????

Express????????URL????????????????????????????????Express????????

  • ???????

    Express??res.send()???HTTP?????????????????????????????????app??????URL????????????????????????????GET/POST???????????

  • ????

    Express???app.get()?app.post()????????????????????????????????????????/????????????

  • ????

    ???????????????????????????????????????????no router?????POST???Express???????????????????req.body??????????

  • ???????Express??????

    const http = require('http');const ejs = require('ejs');const app = require('express-route');http.createServer(app).listen(3000);// ????app.get('/', (req, res) => {    const msg = '????????';    ejs.renderFile('views/index.ejs', { msg }, (err, data) => {        res.send(data);    });});// ??????app.get('/login', (req, res) => {    ejs.renderFile('views/form.ejs', {}, (err, data) => {        res.send(data);    });});// ??????app.post('/dologin', (req, res) => {    console.log(req.body);    res.send("");});

    ???????????Express??????????????????????HTTP???

    转载地址:http://hgip.baihongyu.com/

    你可能感兴趣的文章
    Propel项目改为基于TensorFlow.js
    查看>>
    PyTorch-Tutorials【pytorch官方教程中英文详解】- 6 Autograd
    查看>>
    properties出现中文乱码解决方法(万能)
    查看>>
    Property 'submit' of object #<HTMLFormElement> is not a function
    查看>>
    property--staticmethod--classmethod
    查看>>
    propertyGrid
    查看>>
    propertyPlaceholderConfigurer读取配置文件
    查看>>
    PyTorch-Tutorials【pytorch官方教程中英文详解】- 5 Build Model
    查看>>
    proteus三输入与非门名字_proteus 元件名称对照表
    查看>>
    Protobuf - 语法、字段使用规则、注意事项
    查看>>
    protobuf —— 快速上手
    查看>>
    protobuf —— 认识和安装
    查看>>
    Protobuf 三个关键字required、optional、repeated的理解
    查看>>
    ProtoBuf 原理详解
    查看>>
    Protobuf 实例(java)
    查看>>