I am using Cleave.js with Node.js. Here I am getting document not defined
error. How to resolve this issue?
var express = require('express');
var app = express();
var document = require('html-element').document;
var Cleave = require('cleave.js');
require('cleave.js/dist/addons/cleave-phone.in');
app.get('/', function (req, res) {
var input = document.createElement('input')
input.value = 'XXXXXXXXXX'
const cleave = new Cleave('input', { phone: true, phoneRegionCode: 'in'
});
res.send('Hello World! ' + input.value);
});
app.listen(3000, function () {
console.log('Example app listening on port 3000!');
});
Requirement: I will call this API from another microservice (Java) along with the phone numbers. From this I need result formatted phonenumber.