Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

fix(web-server): since node 12 there is no util.puts #5408

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 2 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
17 changes: 8 additions & 9 deletions testapp/scripts/web-server.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/usr/bin/env node

var express = require('express');
var bodyParser = require('body-parser')
var bodyParser = require('body-parser');
var optimist = require('optimist');
var util = require('util');
var path = require('path');
var env = require('../../spec/environment.js');

Expand All @@ -27,7 +26,7 @@ var main = function() {
testApp.use(bodyParser.json());
testApp.use(testMiddleware);
testApp.listen(port);
util.puts(["Starting express web server in", testAppDir ,"on port", port].
console.log(["Starting express web server in", testAppDir ,"on port", port].
yadimon marked this conversation as resolved.
Show resolved Hide resolved
join(" "));
};

Expand Down Expand Up @@ -55,14 +54,14 @@ var testMiddleware = function(req, res, next) {
res.status(400).send('must specify query');
}
} else if (req.method === 'POST') {
if (req.body.key == 'newChatMessage') {
if (!storage['chatMessages']) {
storage['chatMessages'] = [];
if (req.body.key === 'newChatMessage') {
if (!storage.chatMessages) {
storage.chatMessages = [];
}
storage['chatMessages'].push(req.body.value);
storage.chatMessages.push(req.body.value);
res.sendStatus(200);
} else if (req.body.key == 'clearChatMessages') {
storage['chatMessages'] = [];
} else if (req.body.key === 'clearChatMessages') {
storage.chatMessages = [];
res.sendStatus(200);
} else {
res.status(400).send('Unknown command');
Expand Down