ultimate-express 1.0.3 → 1.0.4

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
@@ -25,11 +25,11 @@ Tested using [wrk](https://github.com/wg/wrk) (`-d 60 -t 1 -c 200`). Etag was di
25
25
 
26
26
  | Test | Path | Express req/sec | µExpress req/sec | Express throughput | µExpress throughput | µExpress speedup |
27
27
  | --------------------------- | ---------------- | --------------- | ---------------- | ------------------ | ------------------- | ---------------- |
28
- | routing/simple-routes.js | / | 10.90k | 70.10k | 2.04 MB/sec | 11.57 MB/sec | **6.43X** |
29
- | routing/lot-of-routes.js | /999 | 4.66k | 51.58k | 0.85 MB/sec | 8.07 MB/sec | **11.07X** |
30
- | routing/some-middlewares.js | /90 | 10.18k | 66.97k | 1.81 MB/sec | 10.42 MB/sec | **6.58X** |
28
+ | routing/simple-routes | / | 10.90k | 70.10k | 2.04 MB/sec | 11.57 MB/sec | **6.43X** |
29
+ | routing/lot-of-routes | /999 | 4.66k | 51.58k | 0.85 MB/sec | 8.07 MB/sec | **11.07X** |
30
+ | routing/some-middlewares | /90 | 10.18k | 66.97k | 1.81 MB/sec | 10.42 MB/sec | **6.58X** |
31
31
  | middlewares/express-static | /static/index.js | 7.52k | 31.08k | 6.92 MB/sec | 26.48 MB/sec | **4.13X** |
32
- | engines/ejs.js | /test | 5.92k | 14.43k | 2.40 MB/sec | 5.53 MB/sec | **2.44X** |
32
+ | engines/ejs | /test | 5.92k | 14.43k | 2.40 MB/sec | 5.53 MB/sec | **2.44X** |
33
33
  | middlewares/body-urlencoded | /abc (POST) | 7.90k | 29.90k | 1.64 MB/sec | 5.36 MB/sec | **3.78X** |
34
34
 
35
35
  Also tested on a real-world application with templates, static files and dynamic pages with data from database ([nekoweb.org](https://nekoweb.org)), and showed about 1.5-4X speedup in requests per second.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultimate-express",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
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": {
@@ -6,6 +6,7 @@ function static(root, options) {
6
6
  if(typeof options.index === 'undefined') options.index = 'index.html';
7
7
  if(typeof options.redirect === 'undefined') options.redirect = true;
8
8
  if(typeof options.fallthrough === 'undefined') options.fallthrough = true;
9
+ if(typeof options.dotfiles === 'undefined') options.dotfiles = 'ignore_files';
9
10
  if(options.extensions) {
10
11
  if(typeof options.extensions !== 'string' && !Array.isArray(options.extensions)) {
11
12
  throw new Error('extensions must be a string or an array');
package/src/response.js CHANGED
@@ -271,6 +271,12 @@ module.exports = class Response extends Writable {
271
271
  case 'deny':
272
272
  this.status(403);
273
273
  return done(new Error('Forbidden'));
274
+ case 'ignore_files':
275
+ if(parts.length > 1 && parts[parts.length - 1].startsWith('.')) {
276
+ this.status(404);
277
+ return done(new Error('Not found'));
278
+ }
279
+ break;
274
280
  case 'ignore':
275
281
  default:
276
282
  this.status(404);