mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-19 18:02:45 +00:00
30 lines
554 B
JavaScript
30 lines
554 B
JavaScript
const axios = require('axios')
|
|
|
|
module.exports = {
|
|
env: {
|
|
token: 'Hello :)',
|
|
num: 3,
|
|
bool: true
|
|
},
|
|
router: {
|
|
routes: [
|
|
{ name: 'user', path: '/users/:id(\\d+)', component: 'pages/_user' }
|
|
]
|
|
},
|
|
build: {
|
|
vendor: ['axios']
|
|
},
|
|
generate: {
|
|
routeParams: {
|
|
'/users/:id(\\d+)': function () {
|
|
return axios.get('http://jsonplaceholder.typicode.com/users')
|
|
.then((res) => {
|
|
return res.data.map((user) => {
|
|
return { id: user.id }
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|