Showing posts with label nodejs. Show all posts
Showing posts with label nodejs. Show all posts

Friday, May 31, 2019

NodeJS HTTP Server Timeout

In Nodejs an HTTP server created by http.createServer() has a default timout of 2 minutes (12000ms). I have an HTML client that calls the server through a GET request and the server starts a batch file that takes more than 5 minutes to finish. After two minutes, the server hits the timout and does some sort of restart (I guess), calls the batch file again and this continues ad infinitum, none of the client GET requests getting a return!

Solution: server.setTimeout(0); //disables timeout

Tuesday, October 09, 2018

Simple login demo with NodeJS

I wrote a simple / bare bones login demo with NodeJS. It uses cookies to remember the user. Note that this is the absolute minimum and should not be used in applications requiring security.

Note that in login.html we have to use HTTP POST (not GET. This line in login.html: form action="/login" method="post" ) so that user name and pass is not displayed in browser address bar!