Sha256: e606803373dfe81fe915a538daf4a9b84a33f28dd93cb598f3106b22a4abc75c
Contents?: true
Size: 714 Bytes
Versions: 2
Compression:
Stored size: 714 Bytes
Contents
const http = require("http") const litexec = require("./ssr_exec") const server = http.createServer((req, res) => { if (req.method === "POST" && req.headers.authorization?.endsWith(process.env.LIT_SSR_AUTH_TOKEN)) { let body = "" req.on("data", (chunk) => { body += chunk.toString() }); req.on("end", () => { let ret = ""; try { ret = litexec.execScript(body) } catch (e) { console.warn(e); } if (ret) { res.end(ret.toString()) } else { res.end("SCRIPT NOT VALID!") } }) } else { res.statusCode = 400 res.end("Invalid Request!") } }) const port = process.env.LIT_SSR_SERVER_PORT server.listen(port, "127.0.0.1")
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bridgetown-lit-renderer-1.1.1 | src/serve.js |
bridgetown-lit-renderer-1.1.0 | src/serve.js |