Welcome aboard! We are happy you are here and wish you good net-raft!
// put into script.js
var http = require('http');
var srv = http.createServer(function (req, res) {
var str = "I am years old!";
var text;
if (str.match(/\d+/g))
text = "a number"
else
text = "not a number";
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end(text);
});
srv.listen(3000);
console.log("Listening to Port 3000");
// type into command prompt "node script.js"
// put this url http://localhost:3000/ into any browser
// at first you must npm install isnumeric
var isNumeric = require("isnumeric");
var checknumber = isNumeric("125");
if(checknumber)
text = "it is a number"
else
text = "it is not a number";
console.log(text);
The most helpful NODEJS solutions
get user ipNODEJS Click to see more ... 7.6K 1.7K