Created
May 15, 2018 11:21
-
-
Save onxssis/59a071d4fd6cbf9b89d3a43ea0ce9611 to your computer and use it in GitHub Desktop.
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 characters
| // 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 | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment