Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to use custom http modules(e.g unit-http) #1327

Closed
wants to merge 2 commits into from
Closed

Allow to use custom http modules(e.g unit-http) #1327

wants to merge 2 commits into from

Conversation

alherd-by
Copy link

This change will allow to use application server Nginx Unit(https://unit.nginx.org/installation/#installation-nodejs-package) in koa applications without any changes to existing codebases.

@codecov
Copy link

codecov bot commented Apr 25, 2019

Codecov Report

Merging #1327 into master will decrease coverage by 0.5%.
The diff coverage is 60%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1327      +/-   ##
==========================================
- Coverage     100%   99.49%   -0.51%     
==========================================
  Files           5        5              
  Lines         393      397       +4     
==========================================
+ Hits          393      395       +2     
- Misses          0        2       +2
Impacted Files Coverage Δ
lib/application.js 98.01% <60%> (-1.99%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 75233d9...9412ef4. Read the comment docs.

const server = http.createServer(this.callback());
let httpModule = http;
if (args.length > 0 && typeof args[0] === 'object') {
httpModule = args[0];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can write httpModule = args.shift();

@kroleg
Copy link

kroleg commented May 1, 2019

i don't think that this should be included in koa because there is already an easy way to use custom http server:

const app = new Koa();
const unitHttp = require('unit-http');
const server = unitHttp.createServer(app.callback());
server.listen(port, () => {
    console.log('Listening on port ' + port);
});

@fl0w
Copy link
Contributor

fl0w commented May 1, 2019

Aye, this is a no go from me. Use app.callback() // e.g. spdy.listen(app.callback())

@alherd-by
Copy link
Author

Thank you for responses.

@alherd-by alherd-by closed this May 3, 2019
@alherd-by alherd-by deleted the algerd/allowing_using_custom_http_modules branch May 3, 2019 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants