@untool/express
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -6,2 +6,13 @@ # Change Log | ||
<a name="0.6.0"></a> | ||
# [0.6.0](https://github.com/untool/untool/compare/v0.5.1...v0.6.0) (2018-05-16) | ||
### Features | ||
* **express:** add untool/express main export ([3e00bac](https://github.com/untool/untool/commit/3e00bac)) | ||
<a name="0.5.0"></a> | ||
@@ -8,0 +19,0 @@ # [0.5.0](https://github.com/untool/untool/compare/v0.4.3...v0.5.0) (2018-05-07) |
@@ -11,33 +11,17 @@ const { | ||
class ExpressMixin extends Mixin { | ||
create(method) { | ||
const create = require(method === 'static' | ||
? './lib/static' | ||
: './lib/serve'); | ||
createServer(mode) { | ||
const isStatic = mode === 'static'; | ||
const create = isStatic ? require('./lib/static') : require('./lib/serve'); | ||
const { options, config, initializeServer, finalizeServer } = this; | ||
return create(method, options, config, initializeServer, finalizeServer); | ||
return create(mode, options, config, initializeServer, finalizeServer); | ||
} | ||
run(method) { | ||
runServer(mode) { | ||
const run = require('./lib/run'); | ||
const app = this.createServer(mode); | ||
const { config, inspectServer, logInfo, logError } = this; | ||
const app = this.create(method); | ||
return run(app, config, inspectServer, logInfo, logError); | ||
} | ||
runServer() { | ||
return this.run('serve'); | ||
} | ||
runDevServer() { | ||
return this.run('develop'); | ||
} | ||
createServer() { | ||
return this.create('serve'); | ||
} | ||
createDevServer() { | ||
return this.create('develop'); | ||
} | ||
createRenderer() { | ||
return this.create('static'); | ||
} | ||
renderLocations() { | ||
const indexFile = require('directory-index'); | ||
const render = this.createRenderer(); | ||
const render = this.createServer('static'); | ||
const { basePath, locations } = this.config; | ||
@@ -89,3 +73,3 @@ const { resolveAbsolute, resolveRelative } = uri; | ||
}, | ||
handler: () => this.runServer(), | ||
handler: () => this.runServer('serve'), | ||
}); | ||
@@ -102,4 +86,4 @@ } | ||
inspectServer: sequence, | ||
createServer: overrideSync, | ||
runServer: overrideSync, | ||
runDevServer: overrideSync, | ||
renderLocations: overrideAsync, | ||
@@ -106,0 +90,0 @@ }; |
{ | ||
"name": "@untool/express", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "untool express mixin", | ||
@@ -27,3 +27,3 @@ "keywords": [ | ||
"@untool/core": "^0.5.0", | ||
"@untool/yargs": "^0.5.0", | ||
"@untool/yargs": "^0.6.0", | ||
"compression": "^1.7.2", | ||
@@ -30,0 +30,0 @@ "directory-index": "^0.1.0", |
@@ -19,3 +19,3 @@ # `@untool/express` | ||
`@untool/express` registers a single command using [`@untool/yargs`](https://github.com/untool/untool/blob/master/packages/yargs/README.md#registercommandsyargs-chalk-pipe): `serve`. As to be expected, this command launches a stand-alone Express server featuring [Helmet](https://helmetjs.github.io) and a [Express' static](https://expressjs.com/en/4x/api.html#express.static) file server middlewares. | ||
`@untool/express` registers a single command using [`@untool/yargs`](https://github.com/untool/untool/blob/master/packages/yargs/README.md#registercommandsyargs-pipe): `serve`. As to be expected, this command launches a stand-alone Express server featuring [Helmet](https://helmetjs.github.io) and a [Express' static](https://expressjs.com/en/4x/api.html#express.static) file server middlewares. | ||
@@ -78,9 +78,9 @@ ```bash | ||
### `runServer(options)` ([override](https://github.com/untool/mixinable/blob/master/README.md#defineoverride)) | ||
### `createServer(mode)` ([override](https://github.com/untool/mixinable/blob/master/README.md#defineoverride)) | ||
If you want to programmatically start a production ready Express server set up using `@untool/express`' [config](https://github.com/untool/untool/blob/master/packages/express/README.md#settings), you can use this utility mixin method that accepts the same options as the CLI [`serve`](https://github.com/untool/untool/blob/master/packages/express/README.md#arguments) method. | ||
To create an Express app to use in your own server, you can use this utility mixin method. It uses `@untool/express`' [settings](https://github.com/untool/untool/blob/master/packages/express/README.md#settings) for its configuration. It accepts a string: `serve`, `develop` or `static`. | ||
### `runDevServer(options)` ([override](https://github.com/untool/mixinable/blob/master/README.md#defineoverride)) | ||
### `runServer(mode)` ([override](https://github.com/untool/mixinable/blob/master/README.md#defineoverride)) | ||
To start a development mode Express server programmatically, you can use this utility mixin method. It uses a [`static`](https://github.com/untool/untool/blob/master/packages/express/README.md#-s----static) option and `@untool/express`' [settings](https://github.com/untool/untool/blob/master/packages/express/README.md#settings) for its configuration. | ||
If you want to programmatically start a production ready Express server set up using `@untool/express`' [config](https://github.com/untool/untool/blob/master/packages/express/README.md#settings), you can use this utility mixin method. It accepts a string: `serve` or `develop`. | ||
@@ -108,3 +108,3 @@ ### `renderLocations()` ([override](https://github.com/untool/mixinable/blob/master/README.md#defineoverride)) | ||
`@untool/express` fully supports HTTPS and using this key, you can configure its SSL/TLS mode. You can either set it to `true` to enable SSL with the included insecure certificate. Or your can tell it to use a [proper](https://letsencrypt.org) SSL certificate. | ||
`@untool/express` fully supports HTTPS and using this key, you can configure its SSL/TLS mode. You can either set it to `true` to enable SSL with the included insecure certificate. Or you can tell it to use a [proper](https://letsencrypt.org) SSL certificate. | ||
@@ -111,0 +111,0 @@ ```json |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
23781
13
301
1
+ Added@untool/yargs@0.6.0(transitive)
- Removed@untool/yargs@0.5.0(transitive)
Updated@untool/yargs@^0.6.0