node.js开发框架---Express框架
生成配置文件:cnpm init --yes
安装express:cnpm install --save-dev express
// 配置服务器
// 引入express框架
const experss=require("express");
let app=experss();//创建express框架实例
let port=8080;
let host="localhost";
// 写入路由
// 注册get路由
app.get('/',(req,res)=>{
res.send("首页");
});
app.listen(port,host,()=>{
console.log(`http://${host}:${port}`);
})
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。