mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-01 00:00:29 +00:00
8ab135af55
Alpha 0.1.0
20 lines
495 B
JavaScript
20 lines
495 B
JavaScript
'use strict'
|
|
|
|
const debug = require('debug')('nuxt:render')
|
|
const { join } = require('path')
|
|
const { getRoute, waitFor } = require('./utils')
|
|
|
|
function * render (req, res, next) {
|
|
if (!this.renderer) {
|
|
yield waitFor(1000)
|
|
yield this.render(req, res, next)
|
|
return
|
|
}
|
|
debug(`Start rendering ${req.url}...`)
|
|
const route = getRoute(req.url)
|
|
const path = join('pages', (route === '/' ? 'index' : route)).replace('.vue', '')
|
|
debug(`Find ${path}.vue`)
|
|
}
|
|
|
|
module.exports = render
|