Hi there, thanks for posting your question. Bun seems to get more and more attention, looks promising. I was able to fix the problem by adding an additional layer with Greenlock.
install the package:
npm install --save greenlock-express@v4
In the index.js
export the app:
const PORT = process.env.PORT || 8000;
if (require.main === module) {
app.listen(PORT, () => {
console.log(`Listening to requests on port http://localhost:${PORT}`);
});
}
module.exports = app;
Created additional server.js
file:
"use strict";
const app = require("./index.js");
require("greenlock-express")
.init({
packageRoot: __dirname,
configDir: "./greenlock.d",
// contact for security and critical bug notices
maintainerEmail: "youremail@text.com",
// whether or not to run at cloudscale
cluster: false
})
// Serves on 80 and 443
// Get's SSL certificates magically!
.serve(app);
and added the config folder greenlock.d
with config.json
file:
{ "sites": [{ "subject": "http://localhost:8000", "altnames": ["http://localhost:8000"] }] }
To run the project with bun
type in the terminal:
bun start -- --staging
Let me know if that works for you!
Cheers,
Olga
Thanks for replying Olga, gonna try it and let you know!