Created
July 8, 2019 07:21
-
-
Save xiezipei/c103db7090d09c2849122b631ee88bc9 to your computer and use it in GitHub Desktop.
Express 的 Hello World 的示例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); // 导入 Express 模块 | |
const app = express(); // 创建 express() 实例 | |
// 路由定义 | |
// 监听根路径`/` | |
app.get('/', (req, res) => { | |
res.send('Hello World!'); | |
}); | |
// 在3000端口启动服务器并打印日志 | |
app.listen(3000, () => { | |
console.log('示例应用正在监听 3000 端口!'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment