3.node 模板

/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

'use strict';

const express = require('express');

// Constants
const PORT = 3000;
const HOST = '0.0.0.0';

// App
const app = express();
app.get('/', (req, res) => {
    res.send('Hello remote world!\n');
});

app.listen(PORT, HOST);
console.log(`Running on http://${HOST}:${PORT}`);

运行方式:node server.js

代码空间:

https://mengxiaoxuan888-vigilant-invention-p5j494pg7wp26gq7.github.dev

转发后的地址:

https://mengxiaoxuan888-vigilant-invention-p5j494pg7wp26gq7-3000.preview.app.github.dev

显示结果:

 

posted @ 2023-02-08 14:06  种太阳  阅读(17)  评论(0编辑  收藏  举报