forked from GSA/sam-styles
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.js
More file actions
28 lines (23 loc) · 890 Bytes
/
server.js
File metadata and controls
28 lines (23 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const fractal = require("./fractal.js");
const logger = fractal.cli.console;
const server = fractal.web.server();
server.on("error", err => logger.error(err.message));
server.start().then(function() {
const header = "Fractal web UI server is running!";
const footer = fractal.cli.isInteractive()
? "Use the 'stop' command to stop the server."
: "Use ^C to stop the server.";
const serverUrl = server.urls.server;
const format = str => logger.theme.format(str, "success", true);
let body = "";
if (!server.isSynced) {
body += `Local URL: ${format(serverUrl)}`;
} else {
const syncUrls = server.urls.sync;
body += `Local URL: ${format(syncUrls.local)}`;
body += `\nNetwork URL: ${format(syncUrls.external)}`;
body += `\nBrowserSync UI: ${format(syncUrls.ui)}`;
}
return logger.box(header, body, footer).persist();
});
server.stop();