lien 3.3.0 → 3.4.0
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/LICENSE +1 -1
- package/README.md +129 -26
- package/lib/index.js +3 -4
- package/package.json +4 -4
- package/test/index.js +2 -2
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2014-
|
|
3
|
+
Copyright (c) 2014-23 Ionică Bizău <bizauionica@gmail.com> (https://ionicabizau.net/)
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,14 +1,54 @@
|
|
|
1
1
|
<!-- Please do not edit this file. Edit the `blah` field in the `package.json` instead. If in doubt, open an issue. -->
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
4
10
|
[](#)
|
|
5
11
|
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# lien
|
|
7
23
|
|
|
8
|
-
[![Support me on Patreon][badge_patreon]][patreon] [![Buy me a book][badge_amazon]][amazon] [![PayPal][badge_paypal_donate]][paypal-donations] [](https://github.com/IonicaBizau/ama) [](https://travis-ci.org/LienJS/Lien/) [](https://www.npmjs.com/package/lien) [](https://www.npmjs.com/package/lien)
|
|
24
|
+
[![Support me on Patreon][badge_patreon]][patreon] [![Buy me a book][badge_amazon]][amazon] [![PayPal][badge_paypal_donate]][paypal-donations] [](https://github.com/IonicaBizau/ama) [](https://travis-ci.org/LienJS/Lien/) [](https://www.npmjs.com/package/lien) [](https://www.npmjs.com/package/lien) [](https://www.codementor.io/johnnyb?utm_source=github&utm_medium=button&utm_term=johnnyb&utm_campaign=github)
|
|
25
|
+
|
|
26
|
+
<a href="https://www.buymeacoffee.com/H96WwChMy" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png" alt="Buy Me A Coffee"></a>
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
9
33
|
|
|
10
34
|
> An easy to use web framework for Node.js.
|
|
11
35
|
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
12
52
|
## :cloud: Installation
|
|
13
53
|
|
|
14
54
|
```sh
|
|
@@ -20,6 +60,17 @@ yarn add lien
|
|
|
20
60
|
```
|
|
21
61
|
|
|
22
62
|
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
23
74
|
## :clipboard: Example
|
|
24
75
|
|
|
25
76
|
|
|
@@ -60,17 +111,28 @@ server.on("serverError", err => {
|
|
|
60
111
|
|
|
61
112
|
|
|
62
113
|
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
63
122
|
## :question: Get Help
|
|
64
123
|
|
|
65
124
|
There are few ways to get help:
|
|
66
125
|
|
|
126
|
+
|
|
127
|
+
|
|
67
128
|
1. Please [post questions on Stack Overflow](https://stackoverflow.com/questions/ask). You can open issues with questions, as long you add a link to your Stack Overflow question.
|
|
68
129
|
2. For bug reports and feature requests, open issues. :bug:
|
|
69
|
-
|
|
70
130
|
3. For direct and quick help, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket:
|
|
71
131
|
|
|
72
132
|
|
|
73
133
|
|
|
134
|
+
|
|
135
|
+
|
|
74
136
|
## :memo: Documentation
|
|
75
137
|
|
|
76
138
|
|
|
@@ -370,17 +432,28 @@ Adds a new middleware. **Note**: This will *not* trigger the hooks.
|
|
|
370
432
|
|
|
371
433
|
|
|
372
434
|
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
|
|
373
446
|
## :yum: How to contribute
|
|
374
447
|
Have an idea? Found a bug? See [how to contribute][contributing].
|
|
375
448
|
|
|
376
449
|
|
|
377
450
|
## :sparkling_heart: Support my projects
|
|
378
|
-
|
|
379
451
|
I open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously,
|
|
380
452
|
this takes time. You can integrate and use these projects in your applications *for free*! You can even change the source code and redistribute (even resell it).
|
|
381
453
|
|
|
382
454
|
However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:
|
|
383
455
|
|
|
456
|
+
|
|
384
457
|
- Starring and sharing the projects you like :rocket:
|
|
385
458
|
- [![Buy me a book][badge_amazon]][amazon]—I love books! I will remember you after years if you buy me one. :grin: :book:
|
|
386
459
|
- [![PayPal][badge_paypal]][paypal-donations]—You can make one-time donations via PayPal. I'll probably buy a ~~coffee~~ tea. :tea:
|
|
@@ -389,42 +462,72 @@ However, if you get some profit from this or just want to encourage me to contin
|
|
|
389
462
|
|
|
390
463
|

|
|
391
464
|
|
|
465
|
+
|
|
392
466
|
Thanks! :heart:
|
|
393
467
|
|
|
394
468
|
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
|
|
395
483
|
## :dizzy: Where is this library used?
|
|
396
484
|
If you are using this library in one of your projects, add it in this list. :sparkles:
|
|
397
485
|
|
|
486
|
+
- `bloggify`
|
|
487
|
+
- `bloggify-cli`
|
|
488
|
+
- `gh-contributions`
|
|
489
|
+
- `web-term`
|
|
490
|
+
- `bloggify-server-prebuilt`
|
|
491
|
+
- `@dottjt/mediareade`
|
|
492
|
+
- `youtube-album-uploader`
|
|
493
|
+
- `youtube-album-uploader-multiple`
|
|
494
|
+
- `bnotify`
|
|
495
|
+
- `test-youtube-api`
|
|
496
|
+
- `bloggify-prebuilt`
|
|
497
|
+
- `learning-node-file-upload`
|
|
498
|
+
- `fb-token-updater`
|
|
499
|
+
- `chewb-youtube-uploader`
|
|
500
|
+
- `nodejs-youtube-uploader`
|
|
501
|
+
- `wrabbit`
|
|
502
|
+
- `learning-nodejs-file-upload`
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
|
|
398
512
|
|
|
399
|
-
- [`bloggify`](https://github.com/Bloggify/Bloggify) (by Bloggify)—We make publishing easy.
|
|
400
|
-
- [`bloggify-cli`](https://github.com/Bloggify/Bloggify) (by Bloggify)—We make publishing easy.
|
|
401
|
-
- [`bloggify-prebuilt`](https://github.com/Bloggify/bloggify-prebuilt#readme)—The prebuilt Bloggify version.
|
|
402
|
-
- [`bloggify-server-prebuilt`](https://bitbucket.org/bloggify/bloggify-server-prebuilt#readme)—Bundled and minified Bloggify server.
|
|
403
|
-
- [`bnotify`](https://github.com/IonicaBizau/bnotify)—A notification system written in NodeJS using the BAT platform.
|
|
404
|
-
- [`chewb-youtube-uploader`](https://github.com/samradical/youtube-uploader) (by Sam Elie)—Wrapper tool around a great uploader.
|
|
405
|
-
- [`gh-contributions`](https://github.com/IonicaBizau/github-contributions)—A tool that generates a repository which being pushed into your GitHub account creates a nice contributions calendar.
|
|
406
|
-
- [`learning-node-file-upload`](https://github.com/IonicaBizau/learning-nodejs)—Learning how file uploads work in a NodeJS server.
|
|
407
|
-
- [`learning-nodejs-file-upload`](https://github.com/IonicaBizau/learning-nodejs)—Learning how file uploads work in a NodeJS server.
|
|
408
|
-
- [`test-youtube-api`](https://github.com/IonicaBizau/test-youtube-api)—Test Youtube API NodeJS module
|
|
409
|
-
- [`web-term`](https://github.com/IonicaBizau/web-term)—A full screen terminal in your browser.
|
|
410
|
-
- [`wrabbit`](https://github.com/jillix/wrabbit) (by jillix)—Wrap scripts by providing the wrapping function.
|
|
411
|
-
- [`youtube-album-uploader`](https://github.com/jpchip/youtube-album-uploader) (by Jared Chapiewsky)—Uploads an mp3 album to Youtube
|
|
412
|
-
- [`youtube-album-uploader-multiple`](https://github.com/Chnapy/youtube-album-uploader-multiple) (by Richard Haddad)—Uploads multiple mp3 files to youtube
|
|
413
513
|
|
|
414
514
|
## :scroll: License
|
|
415
515
|
|
|
416
516
|
[MIT][license] © [Ionică Bizău][website]
|
|
417
517
|
|
|
418
|
-
[badge_patreon]: http://ionicabizau.github.io/badges/patreon.svg
|
|
419
|
-
[badge_amazon]: http://ionicabizau.github.io/badges/amazon.svg
|
|
420
|
-
[badge_paypal]: http://ionicabizau.github.io/badges/paypal.svg
|
|
421
|
-
[badge_paypal_donate]: http://ionicabizau.github.io/badges/paypal_donate.svg
|
|
422
|
-
[patreon]: https://www.patreon.com/ionicabizau
|
|
423
|
-
[amazon]: http://amzn.eu/hRo9sIZ
|
|
424
|
-
[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RVXDDLKKLQRJW
|
|
425
|
-
[donate-now]: http://i.imgur.com/6cMbHOC.png
|
|
426
518
|
|
|
427
|
-
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
[license]: /LICENSE
|
|
428
524
|
[website]: https://ionicabizau.net/
|
|
429
525
|
[contributing]: /CONTRIBUTING.md
|
|
430
526
|
[docs]: /DOCUMENTATION.md
|
|
527
|
+
[badge_patreon]: https://ionicabizau.github.io/badges/patreon.svg
|
|
528
|
+
[badge_amazon]: https://ionicabizau.github.io/badges/amazon.svg
|
|
529
|
+
[badge_paypal]: https://ionicabizau.github.io/badges/paypal.svg
|
|
530
|
+
[badge_paypal_donate]: https://ionicabizau.github.io/badges/paypal_donate.svg
|
|
531
|
+
[patreon]: https://www.patreon.com/ionicabizau
|
|
532
|
+
[amazon]: http://amzn.eu/hRo9sIZ
|
|
533
|
+
[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RVXDDLKKLQRJW
|
package/lib/index.js
CHANGED
|
@@ -23,11 +23,11 @@ var events = require("events"),
|
|
|
23
23
|
session = require("express-session"),
|
|
24
24
|
findValue = require("find-value"),
|
|
25
25
|
qs = require("querystring"),
|
|
26
|
-
parseUrl = require("parse-url"),
|
|
27
26
|
Transformer = require("transformer"),
|
|
28
27
|
setOrGet = require("set-or-get"),
|
|
29
28
|
httpMethods = require("methods"),
|
|
30
|
-
|
|
29
|
+
_require = require("path-to-regexp"),
|
|
30
|
+
pathToRegexp = _require.pathToRegexp,
|
|
31
31
|
iterateObject = require("iterate-object"),
|
|
32
32
|
noop = require("noop6"),
|
|
33
33
|
cookieParser = require("cookie-parser"),
|
|
@@ -56,7 +56,6 @@ var LienObj = function () {
|
|
|
56
56
|
this.req = req;
|
|
57
57
|
this.res = res;
|
|
58
58
|
|
|
59
|
-
this.url = parseUrl(req.originalUrl);
|
|
60
59
|
this.path = this.req.path;
|
|
61
60
|
|
|
62
61
|
if (this.path.charAt(this.path.length - 1) === "/") {
|
|
@@ -67,7 +66,7 @@ var LienObj = function () {
|
|
|
67
66
|
this.host = req.hostname;
|
|
68
67
|
this.params = req.params;
|
|
69
68
|
this.query = req.query;
|
|
70
|
-
this.pathname =
|
|
69
|
+
this.pathname = req.baseUrl + req.path;
|
|
71
70
|
this.method = req.method.toLowerCase();
|
|
72
71
|
this.cookies = req.cookies || {};
|
|
73
72
|
this.server = server;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"test": "node test/index.js"
|
|
4
4
|
},
|
|
5
5
|
"name": "lien",
|
|
6
|
-
"version": "3.
|
|
6
|
+
"version": "3.4.0",
|
|
7
7
|
"description": "An easy to use web framework for Node.js.",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"keywords": [
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"ajs": "^1.2.1",
|
|
24
|
-
"connect-mongo": "^
|
|
24
|
+
"connect-mongo": "^4.6.0",
|
|
25
25
|
"tester": "^1.3.4",
|
|
26
26
|
"tinyreq": "^3.1.2"
|
|
27
27
|
},
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"methods": "^1.1.2",
|
|
48
48
|
"noop6": "^1.0.2",
|
|
49
49
|
"parse-url": "^1.3.0",
|
|
50
|
-
"path-to-regexp": "^
|
|
50
|
+
"path-to-regexp": "^6.2.1",
|
|
51
51
|
"set-or-get": "^1.2.2",
|
|
52
52
|
"transformer": "^1.0.1",
|
|
53
53
|
"ul": "^5.2.1"
|
|
54
54
|
}
|
|
55
|
-
}
|
|
55
|
+
}
|
package/test/index.js
CHANGED
|
@@ -114,7 +114,7 @@ tester.describe("lien", function (t) {
|
|
|
114
114
|
});
|
|
115
115
|
|
|
116
116
|
t.should("add before hook", function () {
|
|
117
|
-
server.hook("before", "
|
|
117
|
+
server.hook("before", "(.*)", "get", function (lien) {
|
|
118
118
|
lien.anotherFromBeforeHook = true;
|
|
119
119
|
});
|
|
120
120
|
});
|
|
@@ -252,7 +252,7 @@ tester.describe("lien", function (t) {
|
|
|
252
252
|
});
|
|
253
253
|
|
|
254
254
|
t.it("load static HTML file", function (cb) {
|
|
255
|
-
server.hook("before", ":foo.*", function (lien, cb) {
|
|
255
|
+
server.hook("before", ":foo(.*)", function (lien, cb) {
|
|
256
256
|
if (!~lien.path.indexOf(".")) {
|
|
257
257
|
return cb();
|
|
258
258
|
}
|