ultimate-express 1.2.19 → 1.2.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -144,7 +144,8 @@ In general, basically all features and options are supported. Use [Express 4.x d
144
144
 
145
145
  ### Application
146
146
 
147
- - ✅ app.listen()
147
+ - ✅ app.listen(port[, host][, callback])
148
+ - ✅ app.listen(unix_socket[, callback])
148
149
  - ✅ app.METHOD() (app.get, app.post, etc.)
149
150
  - ✅ app.route()
150
151
  - ✅ app.all()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultimate-express",
3
- "version": "1.2.19",
3
+ "version": "1.2.20",
4
4
  "description": "The Ultimate Express. Fastest http server with full Express compatibility, based on uWebSockets.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -188,12 +188,18 @@ class Application extends Router {
188
188
  });
189
189
  }
190
190
 
191
- listen(port, callback) {
191
+ listen(port, host, callback) {
192
192
  this.#createRequestHandler();
193
+ // support listen(callback)
193
194
  if(!callback && typeof port === 'function') {
194
195
  callback = port;
195
196
  port = 0;
196
197
  }
198
+ // support listen(port, callback)
199
+ if(typeof host === 'function') {
200
+ callback = host;
201
+ host = undefined;
202
+ }
197
203
  const onListen = socket => {
198
204
  if(!socket) {
199
205
  let err = new Error('Failed to listen on port ' + port + '. No permission or address already in use.');
@@ -208,9 +214,15 @@ class Application extends Router {
208
214
  if(!isNaN(Number(port))) {
209
215
  port = Number(port);
210
216
  args.push(onListen);
217
+ if(host) {
218
+ args.unshift(host);
219
+ }
211
220
  } else {
212
221
  fn = 'listen_unix';
213
222
  args.unshift(onListen);
223
+ if(host) {
224
+ args.unshift(host);
225
+ }
214
226
  }
215
227
  } else {
216
228
  args.push(onListen);