new WebServer( [name] [, options])
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
name |
string |
<optional> |
'server' | The name of the server. |
options |
object |
<optional> |
The app module's extra options defined in its parent's configuration. |
- Source:
- WebServer.js
Properties:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
options.logger |
object |
<optional> |
Logger options |
|
options.verbose |
bool |
<optional> |
false | Flag to output trivial information for diagnostics |
options.env |
string |
<optional> |
Environment, default to process.env.NODE_ENV |
|
options.workingPath |
string |
<optional> |
App's working path, default to process.cwd() |
|
options.configPath |
string |
<optional> |
App's config path, default to "conf" under workingPath |
|
options.configName |
string |
<optional> |
App's config basename, default to "app" |
|
options.backendPath |
string |
<optional> |
'server' | Relative path of back-end server source files |
options.clientPath |
string |
<optional> |
'client' | Relative path of front-end client source files |
options.publicPath |
string |
<optional> |
'public' | Relative path of front-end static files |
options.appModulesPath |
string |
<optional> |
app_modules | Relative path of child modules |
Extends
- Routable(App)
Members
-
appModulesPath :string
-
App modules path.
Type:
- string
- Source:
- WebServer.js
-
backendPath :string
-
Backend files path.
Type:
- string
- Source:
- WebServer.js
-
isServer :boolean
-
Whether it is a server.
Type:
- boolean
- Source:
- WebServer.js
-
route :string
-
Base route.
Type:
- string
- Source:
- WebServer.js
-
server :WebServer
-
Hosting server.
Type:
- Source:
- WebServer.js
Methods
-
getAppByAlias(a)
-
Get the app module object by app alias, usually the app name if no duplicate entry
Parameters:
Name Type Description a
string App module alias
- Source:
- WebServer.js
-
getAppByRoute(p)
-
Get the app module object by base route
Parameters:
Name Type Description p
string App module base route started with "/"
- Source:
- WebServer.js
-
getService(name)
-
Get a registered service
Parameters:
Name Type Description name
string - Source:
- WebServer.js
-
mountApp(app)
-
Mount an app at specified route.
Parameters:
Name Type Description app
WebModule - Source:
- WebServer.js
-
require(relativePath)
-
Require a js module from backend path
Parameters:
Name Type Description relativePath
* - Source:
- WebServer.js
-
requireFromApp(relativePath)
-
Require a module from the source path of an app module
Parameters:
Name Type Description relativePath
* - Source:
- WebServer.js
Events
-
httpReady
-
Http server ready event
- Source:
- serverFeatures/koa.js