Application may be a class
- Dominant language
- JavaScript
- Stars
- 69.5k
- Forks
- 25k
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 9
Description
https://github.com/strongloop/express/blob/5.0/lib/application.js
The fact is that `lib/application.js` may perfectly export the constructor of a "real" `Application` class, and define its prototype as usual instead of `var app = exports = module.exports = {};`. I mean:
```
module.exports = Application;
function Application() {
var router = null;
this.cache = {};
this.settings = {};
this.engines = {};
this.defaultConfiguration();
etc etc
}
Application.prototype.defaultConfiguration = function() {
...
};
Application.prototype.handle = function(req, res, done) {
...
};
```
I don't see any downside in doing it that way, do I miss something? At the end the new `Router` class is now designed as a "real" JavaScript class.
Contributor guide
Assessment
This issue has not been assessed yet.