Skip to content

Commit

Permalink
Merge pull request #3836 from SailingSteve/steveWebAppFeb16-318pm
Browse files Browse the repository at this point in the history
Updated webpack to use wevotedeveloper.com SSL if configured
  • Loading branch information
DaleMcGrew authored Feb 21, 2024
2 parents 3b34011 + cd24729 commit f979d58
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
30 changes: 30 additions & 0 deletions serverWevotedeveloper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* eslint-disable */

// start the express server

// invoke:
// node serverWevotedeveloper.js

const express = require("express");
const app = express();
const fs = require("fs");
const https = require("https");
const path = require("path");
const webAppConfig = require("./src/js/config");

const port = 3000;
const opts = { redirect: true };
const hostname = "wevotedeveloper.com";

app.use("/", express.static("build", opts));
app.all("*", (req, res) => res.sendFile(__dirname + "/build/index.html"));

const certOptions = {
key: fs.readFileSync(path.resolve(__dirname + "/src/cert/wevotedeveloper.com_key.txt")),
cert: fs.readFileSync(path.resolve(__dirname + "/src/cert/wevotedeveloper.com.crt")),
};

const server = https.createServer(certOptions, app).listen(port, function () {
console.log("INFO: https server started", new Date());
console.log(`INFO: Server is at https://${hostname}:${port}`);
});
12 changes: 12 additions & 0 deletions src/js/components/Widgets/StorybookRedirect.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import { renderLog } from '../../common/utils/logging';


// React functional component example
export default function StorybookRedirect () {
renderLog('StorybookRedirect functional component');

return (
<a href="/storybook?path=/docs/design-system--docs">Redirect to Html page</a>
);
}
4 changes: 3 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ if (major < 13) {
} else {
console.log(`Node version is: ${process.version}`);
}
console.log('useRealCerts in webpack.config.js ', useRealCerts);
// console.log('key: ', fs.readFileSync(`./${source}/cert/wevotedeveloper.com.crt`).toString());

module.exports = (env, argv) => ({
entry: path.resolve(__dirname, `./${source}/index.jsx`),
Expand Down Expand Up @@ -166,7 +168,7 @@ module.exports = (env, argv) => ({
static: {
directory: path.join(__dirname, './build'),
},
host: 'localhost',
host: (useRealCerts ? 'wevotedeveloper.com' : 'localhost'),
port,
historyApiFallback: true,
// open: true,
Expand Down

0 comments on commit f979d58

Please sign in to comment.