Write a file t1.js
‘use strict‘; const express = require(‘express‘); // Constants const PORT = 8080; // App const app = express(); app.get(‘/‘, function (req, res) { res.send(‘Hello world\n‘); }); app.listen(PORT); console.log(‘Running on http://localhost:‘ + PORT);
运行
node t1.js
在浏览器输入
http://localhost:8080/
时间: 2024-10-07 06:29:53