express


脚手架:

  • 安装express脚手架:
npm install -g express-generator
  • 查看安装结果:
express --version
  • 创建应用:
express project_name
  • 启动应用:
cd project_name
npm install
第一种:npm start
第二种:node ./bin/www
  • 浏览器运行localhost:3000

  • 文件目录结构:
    app.js 应用的主入口
    bin 启动脚本
    node_modules 依赖的模块
    package.json node 模块的配置文件
    public 静态资源,如 css、js 等存放的目录
    routes 路由规则存放的目录
    views 模板文件存放的目录


移动端常用UI组件库

1、Vant https://youzan.github.io/vant
2、CodeUI https://didi.github.io/cube-ui
3、MintUI http://mint-ui.github.io

PC 端常用UI组件库

1、ElementUI https://element.eleme.cn
2、IVIewUI https://www.iviewui.com


搭建express服务:

npm init
npm install express
  • 新建server.js
const express = require('express')

const app = express();

app.get('/person', (req, res) => {
    res.send({
        name: 'tom',
        age: 18
    })
});

app.listen(5005, (err) => {
    if (!err)
        console.log('服务器启动成功了')
})
node server
http://localhost:5005/person
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容