strapi-ts
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: MongoDB, MySQL, MariaDB, PostgreSQL, SQLite
14 lines (11 loc) • 372 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}`;
};