MCPcopy Index your code
hub / github.com/ember-cli/ember-cli / setupMiddleware

Method setupMiddleware

lib/tasks/server/livereload-server.js:61–89  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

59 }
60
61 setupMiddleware(options) {
62 const tinylr = require('tiny-lr');
63 const Server = tinylr.Server;
64
65 if (options.liveReloadPrefix) {
66 this.liveReloadPrefix = cleanBaseUrl(options.liveReloadPrefix);
67 }
68
69 if (options.liveReload) {
70 if (options.liveReloadPort && options.port !== options.liveReloadPort) {
71 return this.createServerforCustomPort(options, Server).catch((error) => {
72 if (error !== null && typeof error === 'object' && error.code === 'EADDRINUSE') {
73 let url = `http${options.ssl ? 's' : ''}://${this.displayHost(options.liveReloadHost)}:${
74 options.liveReloadPort
75 }`;
76 throw new SilentError(`${error.message}\nLivereload failed on '${url}', It may be in use.`);
77 } else {
78 throw error;
79 }
80 });
81 } else {
82 this.liveReloadServer = this.createServer(options, Server);
83 }
84 this.start();
85 } else {
86 this.ui.writeWarnLine('Livereload server manually disabled.');
87 }
88 return Promise.resolve();
89 }
90
91 start() {
92 this.tree = FSTree.fromEntries([]);

Callers

nothing calls this directly

Calls 4

displayHostMethod · 0.95
createServerMethod · 0.95
startMethod · 0.95

Tested by

no test coverage detected