From 2adc52b152433a6c1013264cb92352bb12d701a8 Mon Sep 17 00:00:00 2001 From: Pedro Cattori Date: Fri, 16 Jun 2023 13:16:06 -0400 Subject: [PATCH] f docs --- docs/other-api/dev-v2.md | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/docs/other-api/dev-v2.md b/docs/other-api/dev-v2.md index 0eec36226b6..9d1902ff11b 100644 --- a/docs/other-api/dev-v2.md +++ b/docs/other-api/dev-v2.md @@ -249,12 +249,44 @@ For example, here's how you could use HTTPS with an Express server: ```ts filename=server.js import fs from "node:fs"; import https from "node:https"; +import path from "node:path"; import express from "express"; +const BUILD_DIR = path.resolve(__dirname, "build"); +const build = require(BUILD_DIR); + const app = express(); // ... code setting up your express app goes here ... -// +let server = https.createServer( + { + key: fs.readFileSync("path/to/key.pem"), + cert: fs.readFileSync("path/to/cert.pem"), + }, + app +); + +let port = 3000; +server.listen(port, () => { + console.log(`👉 https://localhost:${port}`); + + if (process.env.NODE_ENV === "development") { + broadcastDevReady(build); + } +}); ``` + +### Limitations + +hmr: key +hmr: hooks (useloaderdata change) +hdr: harmless console errors +hdr: perf +hdr: sideeffects false + +[templates]: https://github.com/remix-run/remix/tree/main/templates +[watch-paths]: https://remix.run/docs/en/1.17.1/file-conventions/remix-config#watchpaths +[jenseng-code]: https://github.com/jenseng/abuse-the-platform/blob/main/app/utils/singleton.ts +[jenseng-talk]: https://www.youtube.com/watch?v=lbzNnN0F67Y