next pages uses absolute url resolver to access api from getInitialProps

This commit is contained in:
tmshv committed 2019-10-11 23:14:01 +03:00
1 parent 28a4d05fe4
commit a502ddd4df
14 files changed
+37 -24

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
import absoluteUrl from 'next-absolute-url'
export function createApiUrl(req, path) {
const { origin } = absoluteUrl(req, 'localhost:3000')
return `${origin}${path}`
}