Dynamic domain

This commit is contained in:
Bruno SIMON
2016-06-07 14:17:20 +02:00
parent 6e32b80ddd
commit 1126da2747
10 changed files with 31 additions and 16 deletions
+6 -3
View File
@@ -22,6 +22,9 @@ class App
constructor( _options )
{
this.set_options( _options )
this.domain = 'http://' + ip.address() + ':' + this.options.port
this.set_express()
this.set_server()
this.set_socket()
@@ -81,6 +84,8 @@ class App
this.express.set( 'views', path.join( __dirname, 'views' ) )
this.express.use( express.static( path.join( __dirname, 'public' ) ) )
this.express.locals.domain = this.domain
// Controllers
this.express.use( '/', require( './controllers/index.js' ) )
}
@@ -97,11 +102,9 @@ class App
this.server.listen( this.options.port, () =>
{
// URL
let url = 'http://' + ip.address() + ':' + this.options.port
console.log( colors.green( '---------------------------' ) )
console.log( 'server'.green.bold + ' - ' + 'started'.cyan )
console.log( 'server'.green.bold + ' - ' + url.cyan )
console.log( 'server'.green.bold + ' - ' + this.domain.cyan )
} )
}