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/

 

相关文章:

  • 2021-04-18
  • 2022-12-23
  • 2021-12-26
  • 2021-10-08
  • 2021-10-25
  • 2021-08-28
  • 2021-04-04
猜你喜欢
  • 2022-12-23
  • 2022-02-10
  • 2021-07-22
  • 2021-08-16
  • 2021-12-28
相关资源
相似解决方案