INNER CODE UNIT · JavaScript
injectRootProjectSlug
chadbyte/clay · lib/server.js:134
function injectRootProjectSlug(html, slug) {
var bodyPattern = /<body\b([^>]*)>/i;
if (!bodyPattern.test(html)) throw new Error("App shell body is missing");
return html.replace(bodyPattern, function (_match, attributes) {
return '<body' + attributes + ' data-home-project-slug="' + slug + '">';
});
}
/**
* Create a multi-project server.
* opts: { tlsOptions, caPath, pinHash, port, debug, dangerouslySkipPermissions }
*/
function createServer(opts) {
var tlsOptions = opts.tlsOptions || null;
var caPath = opts.caPath || null;
var pinHash = opts.pinHash || null;
var portNum = opts.port || 2633;
var debug = opts.debug || false;