diff --git a/README.md b/README.md index 0372efb24a..fa9cf1c083 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ So far, we get: - Automatic transpilation and bundling (with webpack and babel) - Hot code reloading - Server rendering and indexing of `./pages` -- Static file serving. `./static/` is mapped to `/static/` +- Static file serving. `./static/` is mapped to `/` - Config file `nuxt.config.js` - Code splitting via webpack @@ -97,8 +97,13 @@ This is mostly used for tests purpose but who knows! ```js nuxt.renderRoute('/about', context) -.then(function (html) { - // HTML +.then(function ({ html, error }) { + // You can check error to know if your app displayed the error page for this route + // Useful to set the correct status status code if an error appended: + if (error) { + return res.status(error.statusCode || 500).send(html) + } + res.send(html) }) .catch(function (error) { // And error appended while rendering the route diff --git a/bin/nuxt-build b/bin/nuxt-build index b20a727b15..780c3fe3d8 100755 --- a/bin/nuxt-build +++ b/bin/nuxt-build @@ -23,5 +23,5 @@ new Nuxt(options) }) .catch((err) => { console.error(err) - process.exit() + process.exit(1) }) diff --git a/bin/nuxt-dev b/bin/nuxt-dev index 069e62aaf0..d772cd4b67 100755 --- a/bin/nuxt-dev +++ b/bin/nuxt-dev @@ -15,6 +15,8 @@ if (typeof options.rootDir !== 'string') { options.rootDir = rootDir } +options.dev = true // Add hot reloading and watching changes + new Nuxt(options) .then((nuxt) => { new Server(nuxt) @@ -22,5 +24,5 @@ new Nuxt(options) }) .catch((err) => { console.error(err) - process.exit() + process.exit(1) }) diff --git a/bin/nuxt-start b/bin/nuxt-start index 1ef5bdd692..b0e0f23820 100755 --- a/bin/nuxt-start +++ b/bin/nuxt-start @@ -25,5 +25,5 @@ new Nuxt(options) }) .catch((err) => { console.error(err) - process.exit() + process.exit(1) }) diff --git a/examples/hello-world/pages/about.vue b/examples/hello-world/pages/about.vue index 934bfbfe09..10b34ee7f8 100755 --- a/examples/hello-world/pages/about.vue +++ b/examples/hello-world/pages/about.vue @@ -1,15 +1,25 @@ diff --git a/examples/hello-world/pages/index.vue b/examples/hello-world/pages/index.vue index 52c820e2d7..83731c889d 100755 --- a/examples/hello-world/pages/index.vue +++ b/examples/hello-world/pages/index.vue @@ -1,6 +1,6 @@