Skip to content

Commit

Permalink
Abstract PORT argument for nodejs examples (#1279)
Browse files Browse the repository at this point in the history
  • Loading branch information
thekevinscott authored Dec 2, 2023
1 parent 996ceae commit b8fe485
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions examples/nodejs-custom-file-path/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const fs = require('fs');
const Upscaler = require('upscaler/node');
const tf = require('@tensorflow/tfjs-node');

const PORT = 8080;

const app = express();

const upscaler = new Upscaler({
Expand Down Expand Up @@ -34,5 +36,5 @@ const getUpscaledImage = async () => {
return upscaledTensor;
}

app.listen(8080);
console.log('Running on http://localhost:8080/');
app.listen(PORT);
console.log(`Running on http://localhost:${PORT}/`);
6 changes: 4 additions & 2 deletions examples/nodejs-model/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ const Upscaler = require('upscaler/node');
const x2 = require('@upscalerjs/esrgan-thick/2x');
const tf = require('@tensorflow/tfjs-node');

const PORT = 8080;

const app = express();

const upscaler = new Upscaler({
Expand Down Expand Up @@ -33,5 +35,5 @@ const getUpscaledImage = async () => {
return upscaledTensor;
}

app.listen(8080);
console.log('Running on http://localhost:8080/');
app.listen(PORT);
console.log(`Running on http://localhost:${PORT}/`);
6 changes: 4 additions & 2 deletions examples/nodejs/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const fs = require('fs');
const Upscaler = require('upscaler/node');
const tf = require('@tensorflow/tfjs-node');

const PORT = 8080;

const app = express();

const upscaler = new Upscaler();
Expand All @@ -28,5 +30,5 @@ const getUpscaledImage = async () => {
return upscaledTensor;
}

app.listen(8080);
console.log('Running on http://localhost:8080/');
app.listen(PORT);
console.log(`Running on http://localhost:${PORT}/`);

0 comments on commit b8fe485

Please sign in to comment.