Skip to content

Commit

Permalink
refactor(magic-html): use string template (#2232)
Browse files Browse the repository at this point in the history
* chore(magic-html): use string template

* chore: lint server.js

* chore: fix lint

* chore: refactor search
  • Loading branch information
rishabh3112 authored and hiroppy committed Aug 30, 2019
1 parent 88f0fc9 commit 62e874c
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lib/Server.js
Expand Up @@ -919,14 +919,9 @@ class Server {
return next();
}
// Serve a page that executes the javascript
res.write(
'<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body><script type="text/javascript" charset="utf-8" src="'
);
res.write(_path);
res.write('.js');
res.write(req._parsedUrl.search || '');

res.end('"></script></body></html>');
const queries = req._parsedUrl.search || '';
const responsePage = `<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body><script type="text/javascript" charset="utf-8" src="${_path}.js${queries}"></script></body></html>`;
res.send(responsePage);
} catch (err) {
return next();
}
Expand Down

0 comments on commit 62e874c

Please sign in to comment.