Files
node/server.js

24 lines
778 B
JavaScript
Raw Permalink Normal View History

2019-04-17 20:52:55 -07:00
/*---------------------------------------------------------------------------------------------
* 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');
2025-10-27 15:07:20 +08:00
const path = require('path');
2019-04-17 20:52:55 -07:00
// Constants
const PORT = 3000;
const HOST = '0.0.0.0';
// App
const app = express();
app.get('/', (req, res) => {
res.send('Hello remote world!\n');
});
2025-10-27 15:07:20 +08:00
// 提供 favicon.ico 静态资源
app.use('/favicon.ico', express.static(path.join(__dirname, 'favicon.ico')));
2019-04-17 20:52:55 -07:00
app.listen(PORT, HOST);
console.log(`Running on http://${HOST}:${PORT}`);