@digicms/cms
Version:
An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite
13 lines (10 loc) • 368 B
JavaScript
;
/**
* Returns a url base on hostname, port and ssl options
*/
module.exports = ({ hostname, port, ssl = false }) => {
const protocol = ssl ? 'https' : 'http';
const defaultPort = ssl ? 443 : 80;
const portString = port === undefined || parseInt(port, 10) === defaultPort ? '' : `:${port}`;
return `${protocol}://${hostname}${portString}`;
};