Welcome aboard! We are happy you are here and wish you good net-raft!
// you need to install "npm i --save express express-device"
// put into detect.js
var express = require('express');
var app = express();
var device = require('express-device');
app.use(device.capture());
app.get('/mydevice',function(req,res) {
res.send(req.device.name.toUpperCase()); // Possible Values: Example: iPhone.
// If the option parseUserAgent is set to false, then it will return an empty string
});
app.listen(3000);
console.log("Listening to Port 3000");
// then put this url into any browser http://localhost:3000/mydevice
The most helpful NODEJS solutions
get user ipNODEJS Click to see more ... 7.6K 1.7K