Start FlipperServerImpl as part of flipper-server

Summary: The previous started up a dev / web server for bundling in flipper-server, this diff starts the flipper server itself, so that we can connect the client to it (done in next diffs)

Reviewed By: passy, aigoncharov

Differential Revision: D32627390

fbshipit-source-id: b48de20f076e1e13842368d16a090708d533b69e
This commit is contained in:
Michel Weststrate
2021-12-08 04:25:28 -08:00
committed by Facebook GitHub Bot
parent 0dfc73da93
commit 1308edc790
8 changed files with 267 additions and 91 deletions

View File

@@ -11,9 +11,35 @@
// needs to be come independently runnable, prebundled, distributed, etc!
// in future require conditionally
import {startWebServerDev} from './startWebServerDev';
import {startFlipperServer} from './startFlipperServer';
import {startBaseServer} from './startBaseServer';
import chalk from 'chalk';
import path from 'path';
startWebServerDev().catch((e) => {
console.error(chalk.red('Server error: '), e);
process.exit(1);
});
const PORT = 52342;
const rootDir = path.resolve(__dirname, '..', '..');
const staticDir = path.join(rootDir, 'static');
async function start() {
const {app, server, socket} = await startBaseServer({
port: PORT,
staticDir,
entry: 'index.web.dev.html',
});
return Promise.all([
startFlipperServer(rootDir, staticDir),
startWebServerDev(app, server, socket, rootDir),
]);
}
start()
.then(() => {
console.log(
`Flipper DEV server started at http://localhost:${PORT}/index.web.dev.html`,
);
})
.catch((e) => {
console.error(chalk.red('Server error: '), e);
process.exit(1);
});