feat: improve custom-server example

This commit is contained in:
Clark Du 2017-10-19 17:38:18 +08:00 committed by Pooya Parsa
parent 4b6236499c
commit 65136ac550
2 changed files with 4 additions and 2 deletions

View File

@ -1,8 +1,9 @@
{
"name": "nuxt-custom-server",
"dependencies": {
"chalk": "^2.2.0",
"express": "^4.15.3",
"nuxt": "^1.0.0-rc3"
"nuxt": "latest"
},
"scripts": {
"dev": "node server.js",

View File

@ -1,5 +1,6 @@
const app = require('express')()
const { Nuxt, Builder } = require('nuxt')
const chalk = require('chalk')
const host = process.env.HOST || '127.0.0.1'
const port = process.env.PORT || 3000
@ -21,4 +22,4 @@ app.use(nuxt.render)
// Start express server
app.listen(port, host)
console.log('Server listening on ' + host + ':' + port)
console.log('\n' + chalk.bgGreen.black(' OPEN ') + chalk.green(` http://${host}:${port}`))