mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 07:05:11 +00:00
e5efc25940
[release]
19 lines
421 B
JavaScript
19 lines
421 B
JavaScript
const fetch = require('node-fetch-native')
|
|
|
|
export default {
|
|
plugins: [
|
|
'@/plugins/vue-placeholders.js'
|
|
],
|
|
modules: [
|
|
'@nuxt/http'
|
|
],
|
|
generate: {
|
|
async routes () {
|
|
const posts = await fetch('https://jsonplaceholder.typicode.com/posts').then(res => res.json()).then(d => d.slice(0, 20))
|
|
const routes = posts.map(post => `/posts/${post.id}`)
|
|
|
|
return ['/'].concat(routes)
|
|
}
|
|
}
|
|
}
|