EN
Node.js - get hostname
0 points
In this article, we would like to show you how to get hostname in Node.js.
Quick solution:
xxxxxxxxxx
1
const os = require('os');
2
3
const hostname = os.hostname();
Note:
The solution returns only the hostname without the domain name.