Welcome aboard! We are happy you are here and wish you good net-raft!
// at first you install "npm install express-useragent --save","npm install yamlparser --save","npm install request --save" in node.js command prompt
//put this code into test.js
var express = require('express');
var app = express(),
useragent = require('express-useragent');
app.get('/', function(req, res){
var source = req.headers['user-agent'];
var info = useragent.parse(source);
res.send(info['browser']);
})
app.listen(3000);
console.log("Listening to Port 3000");
// type "node test.js" in command prompt
// then put this url "http://localhost:3000/" into any browser
The most helpful NODEJS solutions
get user ipNODEJS Click to see more ... 7.6K 1.7K