mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
Initial config with a few files that build on client and server side.
This commit is contained in:
24
app/server/server.ts
Normal file
24
app/server/server.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
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));
|
||||
}
|
||||
9
app/server/tsconfig.json
Normal file
9
app/server/tsconfig.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "../../buildtools/tsconfig-base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../build/app/server",
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../common" }
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user