helidium / mitol Goto Github PK
View Code? Open in Web Editor NEWLightweight NodeJS http server
License: Other
Lightweight NodeJS http server
License: Other
npm install produces:
In file included from ../mns.cc:1:
../http.h:10:10: fatal error: '../src/Server.h' file not found
#include "../src/Server.h"
^
npm: v4.6.1
node: v6.11.1
express.js
`const express = require('express');
const app = express()
const http = require('mitol');
app.get('/', (req, res) => {
res.send('Hello World!');
});
http.createServer(app).listen(3000, () => {
console.log('Example app listening on port 3000!');
});`
kao.js
`const mitol = require('mitol');
const Koa = require('koa');
const app = new Koa();
// response
app.use(ctx => {
ctx.status = 200;
ctx.body = 'Hello World!';
});
mitol.createServer(app.callback()).listen(3000);`
wrk -t12 -c400 -d3s http://127.0.0.1:3000/
Running 3s test @ http://127.0.0.1:3000/
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 0.00us 0.00us 0.00us -nan%
Req/Sec 0.00 0.00 0.00 -nan%
0 requests in 3.10s, 0.00B read
Socket errors: connect 0, read 15897, write 0, timeout 0
Requests/sec: 0.00
Transfer/sec: 0.00B
im trying mitol with express but if using morgan logger express try remote access or something here error report:
Cannot read property 'remoteAddress' of undefined
TypeError: Cannot read property 'remoteAddress' of undefined
at forwarded (/mnt/c/Users/x0nim/Desktop/workspace/avukat-node/node_modules/forwarded/index.js:31:35)
at alladdrs (/mnt/c/Users/x0nim/Desktop/workspace/avukat-node/node_modules/proxy-addr/index.js:57:15)
at proxyaddr (/mnt/c/Users/x0nim/Desktop/workspace/avukat-node/node_modules/proxy-addr/index.js:231:15)
at IncomingMessage.ip (/mnt/c/Users/x0nim/Desktop/workspace/avukat-node/node_modules/express/lib/request.js:351:10)
at getip (/mnt/c/Users/x0nim/Desktop/workspace/avukat-node/node_modules/morgan/index.js:466:14)
at logger (/mnt/c/Users/x0nim/Desktop/workspace/avukat-node/node_modules/morgan/index.js:107:26)
at Layer.handle [as handle_request] (/mnt/c/Users/x0nim/Desktop/workspace/avukat-node/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/mnt/c/Users/x0nim/Desktop/workspace/avukat-node/node_modules/express/lib/router/index.js:317:13)
at /mnt/c/Users/x0nim/Desktop/workspace/avukat-node/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/mnt/c/Users/x0nim/Desktop/workspace/avukat-node/node_modules/express/lib/router/index.js:335:12)
โ cache-proxy-service node index.js
Example app listening on port 8080!
TypeError: (options.buffer || req).pipe is not a function
at Array.stream (/home/stephen/dev/cache-proxy-service/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js:161:29)
at ProxyServer.<anonymous> (/home/stephen/dev/cache-proxy-service/node_modules/http-proxy/lib/http-proxy/index.js:80:21)
at redis.get.then (/home/stephen/dev/cache-proxy-service/index.js:31:13)
at tryCatcher (/home/stephen/dev/cache-proxy-service/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/stephen/dev/cache-proxy-service/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/home/stephen/dev/cache-proxy-service/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/home/stephen/dev/cache-proxy-service/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/home/stephen/dev/cache-proxy-service/node_modules/bluebird/js/release/promise.js:693:18)
at Async._drainQueue (/home/stephen/dev/cache-proxy-service/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/home/stephen/dev/cache-proxy-service/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/home/stephen/dev/cache-proxy-service/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:781:20)
at tryOnImmediate (timers.js:743:5)
at processImmediate [as _immediateCallback] (timers.js:714:5)
Is there an effort being made on this project still?
I'd like to see a roadmap, basically a list of features that the http
module has that mitol
will eventually implement. The roadmap should go in the README.md
file.
Also, a list of quirks where mitol
differs from the http
module would be much appreciated. This list would not include missing features, since that's what the roadmap is for.
This will help users understand where the project is lacking, and maybe even inspire more contributors.
Thanks!
Hi there! Would love to try this out in real products, but realistically, it would only be feasible if I could load this in via npm.
Is there any way that this is possible?
FWIW, as of writing this, the name mitol
is available.
The response object is a plain object. It should extend ReadableStream
In most cases even 'hello world' server quits with segfault when trying to reach smth like 2k rps on linux.
Output on mac differs a bit, returning malloc and/or 100% CPU.
Tried to make "hello world" post/put request handler but it does not seem to work (while GET does work as expected)
Here's the code:
const http = require('mitol');
let server = http.createServer((req, res) => {
if (req.method === 'GET') {
res.end('Hello World!'); // works as expected
return;
}
var str = '';
req.on('data', function(data){
str += data;
});
req.on('end', function(){
res.end('POST pingback', str); // never fires
});
});
server.listen(8099, () => {
console.log('Example app listening on port 8099!')
});
Various libraries (including) express modify the value of the URL (e.g for serving sub apps). This is incompatible with mitol as the field is implemented as a const char
var server = http.createServer();
server.on('request', function(req, res) {
...
});
Function never gets registered/called.
Here's the code:
const http = require('mitol');
let server = http.createServer((req, res) => {
res.statusCode = 400;
res.end();
});
server.listen(8099, () => {
console.log('Example app listening on port 8099!')
});
Nothing is returned in response (lets say timeout).
When trying to set e.g statusCode = 404, it works as expected.
I'm running an ultra simple server with koa and I'm seeing this
TypeError: x.ee.removeListener is not a function
at cleanup (/Users/omni/Documents/git/drive-proxy/node_modules/ee-first/index.js:62:12)
at callback (/Users/omni/Documents/git/drive-proxy/node_modules/ee-first/index.js:54:5)
at onevent (/Users/omni/Documents/git/drive-proxy/node_modules/ee-first/index.js:93:5)
at respond (/Users/omni/Documents/git/drive-proxy/node_modules/koa/lib/application.js:229:43)
at handleResponse (/Users/omni/Documents/git/drive-proxy/node_modules/koa/lib/application.js:134:36)
at <anonymous>
fish: 'node index' terminated by signal SIGSEGV (Address boundary error)
Here is what I'm running
const mitol = require('mitol');
const Koa = require('koa');
const app = new Koa();
// response
app.use(ctx => {
ctx.status = 200;
ctx.body = 'Hello';
});
mitol.createServer(app.callback()).listen(3000);
This works without fail when I'm using http
as normal
Check the request content type for proper data retrieval type.
npm install https://github.com/Helidium/Mitol.git
won't work because you don't have a package.json in the repo
Is there any way i can use mitol
instead of native node js https
?
As per #15 currently request.connection is missing. This breaks logging middleware in express (e.g morgan) as well as some authentication solutions.
I'm just curious how come the techempower benchmarks are showing mitol with a ~20% improvement over the default implementation, while the readme is claiming a 3x improvement?
https://www.techempower.com/benchmarks/#section=data-r15&hw=ph&test=plaintext&l=h4s9h9
HI, thanks for your effort in this project. I want ask you, what is the status of this project. Is usable on production?
Is it possible to support node 10?
server.on('connection', callback) leads to error server.on is not a function
same as server.unref()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.