Skip to content

Commit 62e874c

Browse files
rishabh3112hiroppy
authored andcommitted
refactor(magic-html): use string template (#2232)
* chore(magic-html): use string template * chore: lint server.js * chore: fix lint * chore: refactor search
1 parent 88f0fc9 commit 62e874c

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

lib/Server.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -919,14 +919,9 @@ class Server {
919919
return next();
920920
}
921921
// Serve a page that executes the javascript
922-
res.write(
923-
'<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body><script type="text/javascript" charset="utf-8" src="'
924-
);
925-
res.write(_path);
926-
res.write('.js');
927-
res.write(req._parsedUrl.search || '');
928-
929-
res.end('"></script></body></html>');
922+
const queries = req._parsedUrl.search || '';
923+
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>`;
924+
res.send(responsePage);
930925
} catch (err) {
931926
return next();
932927
}

0 commit comments

Comments
 (0)