Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PE-357: Fix externally filed issue against this repository #74

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions templates/cra-template-brightsign-app/template/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_PORT=8020
4 changes: 3 additions & 1 deletion templates/cra-template-brightsign-app/template/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ function App() {

useEffect(() => {
const interval = setInterval(async () => {
const { text } = await (await fetch("/text")).json();
const port = process.env.REACT_APP_PORT || 8020;
const rawText = await fetch(`http://localhost:${port}/text`);
const { text } = await rawText.json();

if (text) {
setHeader(text);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ function main()
' Enable SSH
enableSSH()

' Initialize roNodeJs with path or correct filename, whether webpack is used or not.
node_js = CreateObject("roNodeJs", "sd:/dist/backend.js", {message_port: mp, node_arguments: ["--inspect=0.0.0.0:2999"], arguments: []})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is moving this line before creating the HTML widget creation, part of the solution?


' Create HTML Widget
widget = createHTMLWidget(mp)
widget.Show()

' Initialize roNodeJs with path or correct filename, whether webpack is used or not.
node_js = CreateObject("roNodeJs", "sd:/dist/backend.js", {message_port: mp, node_arguments: ["--inspect=0.0.0.0:2999"], arguments: []})

'Event Loop test
while true
msg = wait(0,mp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ const app = express();

app.use(express.json());
app.use(express.static(path));
app.use(function (req, res, next) {
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
next();
});

let text = "";
let text = "BrightSign React Web App Template";

// POST endpoint to receive updates
app.post("/text", (req, res) => {
Expand All @@ -24,5 +30,5 @@ app.get("/text", (req, res) => {
res.status(200).json({ text });
});

const PORT = 8020;
app.listen(PORT, () => console.log(`Server running on port ${PORT}`));
const port = process.env.REACT_APP_PORT || 8020;
app.listen(port, () => console.log(`Server running on port ${port}`));
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ function main()
enableLDWS()
' Enable SSH

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please format/align the comments and method calls correctly.

enableSSH()

' Initialize roNodeJs with path or correct filename, whether webpack is used or not.
node_js = CreateObject("roNodeJs", "sd:/dist/backend.js", {message_port: mp, node_arguments: ["--inspect=0.0.0.0:2999"], arguments: []})

' Create HTML Widget
widget = createHTMLWidget(mp)
widget.Show()

' Initialize roNodeJs with path or correct filename, whether webpack is used or not.
node_js = CreateObject("roNodeJs", "sd:/dist/backend.js", {message_port: mp, node_arguments: ["--inspect=0.0.0.0:2999"], arguments: []})

'Event Loop
while true
Expand Down

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this not need the app.use block added in the templates/cra-template-brightsign-app/template/src/server/index.js file above?

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const app = express();
app.use(express.json());
app.use(express.static(path));

let text = "";
let text = "BrightSign React Web App Dashboard Template";

// POST endpoint to receive updates
app.post("/text", (req, res) => {
Expand Down