Created
May 15, 2018 11:21
-
-
Save onxssis/59a071d4fd6cbf9b89d3a43ea0ce9611 to your computer and use it in GitHub Desktop.
Revisions
-
onxssis created this gist
May 15, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ // add this to hooks.js in hooks.after.providersBooted fn View.global('absoluteUrl', function (path) { const req = this.resolve('request') let baseUrl = req.secure() ? 'https://' : 'http://' baseUrl += req.headers().host + '/' if (typeof path !== 'undefined') { path = (path.substring(0, 1) === '/') ? path.substring(1) : path return baseUrl + path } return baseUrl })