usefulBee usefulBee - 16 days ago 5
Node.js Question

Node.js Command Prompt not Responding to keyboard

Below the last line, the command is flashing as expected, yet I can't write any commands. I could restart the program but that does not solve the problem indefinitely. What is wrong??

Code is based on the following tutorial:

NodeJs Tutorials: Mastering NodeJS, Part 1: Introduction to Node

'use strict'

const http = require('http');
const express = require('express');
const fs = require('fs');

const configJson = fs.readFileSync('./config.json');
const config = JSON.parse(configJson);

const app = express();


const httpServer = http.createServer(app);

httpServer.listen(config.webServer.port, function(err){
if(err) {
console.log(`web server on port ${config.webServer.port}`);

enter image description here


This happens because your code is still running (the httpServer.listen function is waiting new connections on the 3001 port), you can kill the execution with Ctrl + C, but this is normal behavior, this should happen.