next pages uses absolute url resolver to access api from getInitialProps
This commit is contained in:
1 parent
28a4d05fe4
commit
a502ddd4df
14 files changed
+37
-24
No files matched your search
@@ -0,0 +1,7 @@
|
||||
import absoluteUrl from 'next-absolute-url'
|
||||
|
||||
export function createApiUrl(req, path) {
|
||||
const { origin } = absoluteUrl(req, 'localhost:3000')
|
||||
|
||||
return `${origin}${path}`
|
||||
}
|
||||
Reference in new issue
Block a user