You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gristlabs_grist-core/app/server/server.ts

25 lines
679 B

import * as express from 'express';
import * as http from 'http';
import {AddressInfo} from 'net';
const G = {
port: parseInt(process.env.PORT!, 10) || 8484,
host: process.env.HOST || 'localhost',
};
export async function main() {
const app = express();
const server = http.createServer(app);
app.use(express.static('static'));
// Start listening.
await new Promise((resolve, reject) => server.listen(G.port, G.host, resolve).on('error', reject));
const address = server.address() as AddressInfo;
console.warn(`Server listening at http://${address.address}:${address.port}`);
}
if (require.main === module) {
main().catch((err) => console.error(err));
}