@ladjs/web
Advanced tools
Comparing version 0.0.6 to 0.0.7
18
index.js
@@ -45,2 +45,3 @@ const http = require('http'); | ||
class Server { | ||
// eslint-disable-next-line complexity | ||
constructor(config) { | ||
@@ -50,4 +51,3 @@ this.config = Object.assign( | ||
cabin: {}, | ||
protocol: process.env.WEB_PROTOCOL | 'http', | ||
port: process.env.WEB_PORT || 3000, | ||
protocol: process.env.WEB_PROTOCOL || 'http', | ||
ssl: { | ||
@@ -314,2 +314,4 @@ key: process.env.WEB_SSL_KEY_PATH | ||
// expose app and server | ||
this.app = app; | ||
this.server = server; | ||
@@ -320,3 +322,8 @@ | ||
listen(fn) { | ||
listen(port, fn) { | ||
if (_.isFunction(port)) { | ||
fn = port; | ||
port = null; | ||
} | ||
const { logger } = this.config; | ||
@@ -331,6 +338,9 @@ if (!_.isFunction(fn)) | ||
this.server = this.server.listen(this.config.port, fn); | ||
this.server = this.server.listen(port, fn); | ||
return this.server; | ||
} | ||
close(fn) { | ||
this.server.close(fn); | ||
return this; | ||
} | ||
@@ -337,0 +347,0 @@ } |
{ | ||
"name": "@ladjs/web", | ||
"description": "Web server for Lad", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"author": "Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)", | ||
@@ -14,3 +14,3 @@ "bugs": { | ||
"dependencies": { | ||
"@ladjs/auth": "^0.0.3", | ||
"@ladjs/auth": "^0.0.4", | ||
"@ladjs/i18n": "^0.0.8", | ||
@@ -17,0 +17,0 @@ "@ladjs/koa-better-static": "^1.0.5", |
@@ -38,31 +38,5 @@ # [**@ladjs/web**](https://github.com/ladjs/web) | ||
```js | ||
#!/usr/bin/env node | ||
const Server = require('@ladjs/web'); | ||
const Graceful = require('@ladjs/graceful'); | ||
See <https://github.com/ladjs/lad/blob/master/template/web.js> for the most up to date usage example. | ||
const config = require('./config'); | ||
const routes = require('./routes'); | ||
const { i18n, logger } = require('./helpers'); | ||
const { Users } = require('./app/models'); | ||
const server = new Server({ | ||
Users, | ||
routes: routes.web, | ||
logger, | ||
i18n, | ||
meta: config.meta, | ||
views: config.views | ||
}); | ||
if (!module.parent) { | ||
server.listen(); | ||
const graceful = new Graceful({ server, logger }); | ||
graceful.listen(); | ||
} | ||
module.exports = server; | ||
``` | ||
## Contributors | ||
@@ -69,0 +43,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
295
22
255750
58
+ Added@ladjs/auth@0.0.4(transitive)
- Removed@ladjs/auth@0.0.3(transitive)
- Removedstrength@0.1.4(transitive)
Updated@ladjs/auth@^0.0.4