Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
32d9b75d
Commit
32d9b75d
authored
Sep 01, 2017
by
Brikou CARRE
Committed by
Arunoda Susiripala
Sep 01, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use https to prevent mixed content when served over https (#2741)
parent
a779d830
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
3 deletions
+3
-3
next.config.js
examples/with-static-export/next.config.js
+1
-1
index.js
examples/with-static-export/pages/index.js
+1
-1
post.js
examples/with-static-export/pages/post.js
+1
-1
No files found.
examples/with-static-export/next.config.js
View file @
32d9b75d
...
@@ -3,7 +3,7 @@ const fetch = require('isomorphic-fetch')
...
@@ -3,7 +3,7 @@ const fetch = require('isomorphic-fetch')
module
.
exports
=
{
module
.
exports
=
{
async
exportPathMap
()
{
async
exportPathMap
()
{
// we fetch our list of posts, this allow us to dynamically generate the exported pages
// we fetch our list of posts, this allow us to dynamically generate the exported pages
const
response
=
await
fetch
(
'http://jsonplaceholder.typicode.com/posts?_page=1'
)
const
response
=
await
fetch
(
'http
s
://jsonplaceholder.typicode.com/posts?_page=1'
)
const
postList
=
await
response
.
json
()
const
postList
=
await
response
.
json
()
// tranform the list of posts into a map of pages with the pathname `/post/:id`
// tranform the list of posts into a map of pages with the pathname `/post/:id`
...
...
examples/with-static-export/pages/index.js
View file @
32d9b75d
...
@@ -7,7 +7,7 @@ import Post from '../components/post'
...
@@ -7,7 +7,7 @@ import Post from '../components/post'
export
default
class
extends
Component
{
export
default
class
extends
Component
{
static
async
getInitialProps
()
{
static
async
getInitialProps
()
{
// fetch list of posts
// fetch list of posts
const
response
=
await
fetch
(
'http://jsonplaceholder.typicode.com/posts?_page=1'
)
const
response
=
await
fetch
(
'http
s
://jsonplaceholder.typicode.com/posts?_page=1'
)
const
postList
=
await
response
.
json
()
const
postList
=
await
response
.
json
()
return
{
postList
}
return
{
postList
}
}
}
...
...
examples/with-static-export/pages/post.js
View file @
32d9b75d
...
@@ -6,7 +6,7 @@ import fetch from 'isomorphic-fetch'
...
@@ -6,7 +6,7 @@ import fetch from 'isomorphic-fetch'
export
default
class
extends
Component
{
export
default
class
extends
Component
{
static
async
getInitialProps
({
query
})
{
static
async
getInitialProps
({
query
})
{
// fetch single post detail
// fetch single post detail
const
response
=
await
fetch
(
`http://jsonplaceholder.typicode.com/posts/
${
query
.
id
}
`
)
const
response
=
await
fetch
(
`http
s
://jsonplaceholder.typicode.com/posts/
${
query
.
id
}
`
)
const
post
=
await
response
.
json
()
const
post
=
await
response
.
json
()
return
{
...
post
}
return
{
...
post
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment