in src/msha/server.ts [90:145]
function onServerStart(server: https.Server | http.Server, socketConnection: net.Socket | undefined) {
return () => {
if (IS_APP_DEV_SERVER()) {
// prettier-ignore
logger.log(
`\nUsing dev server for static content:\n` +
` ${chalk.green(DEFAULT_CONFIG.outputLocation)}`
);
} else {
// prettier-ignore
logger.log(
`\nServing static content:\n` +
` ${chalk.green(DEFAULT_CONFIG.outputLocation)}`
);
}
if (DEFAULT_CONFIG.apiLocation) {
if (IS_API_DEV_SERVER()) {
// prettier-ignore
logger.log(
`\nUsing dev server for API:\n` +
` ${chalk.green(DEFAULT_CONFIG.apiLocation)}`
);
} else {
// prettier-ignore
logger.log(
`\nServing API:\n` +
` ${chalk.green(DEFAULT_CONFIG.apiLocation)}`
);
}
}
// note: this string must not change. It is used by the VS Code extension.
// see: https://github.com/Azure/static-web-apps-cli/issues/124
//--------------------------------------------------------------------------------
const serverAddress = address(DEFAULT_CONFIG.host, Number(SWA_CLI_PORT), SWA_CLI_APP_PROTOCOL);
let logMessage = `\nAzure Static Web Apps emulator started at ${chalk.green(serverAddress)}. Press CTRL+C to exit.\n\n`;
//--------------------------------------------------------------------------------
logger.log(logMessage);
if (DEFAULT_CONFIG.open) {
open(serverAddress);
}
server.on("upgrade", onWsUpgrade());
registerProcessExit(() => {
socketConnection?.end(() => logger.info("WebSocket connection closed."));
server.close(() => logger.log("Server stopped."));
proxyApp.close(() => logger.log("App proxy stopped."));
logger.info("Azure Static Web Apps emulator shutting down...");
process.exit(0);
});
};
}