const fetch = require("node-fetch") class OpenGraphURL { constructor() { } async post (obj ) { const response = await fetch('http://localhost/urlshortener/api/index.php', { method: 'post', body: JSON.stringify(obj), headers: { 'Content-Type': 'application/json' }, }) const res = await response.json() const data = await res.url; return data; } } exports.post = (obj) => { const open = new OpenGraphURL(); return await open.post(obj) }