Node.js Fundamentals: Web Server Without Dependencies
21–30 of 44 posts
Re: Node.js Fundamentals: Web Server Without Dependencies
#22Earlier quoted context omitted.
IIRC before nodejs+express the req/resp/next paradigm and middleware paradigm had never been so accessible. Other frameworks had it of course, but it was often hidden behind layers of abstraction or little quibbly bits. Express gave you just what you needed for both middleware and handlers: app.get('/', function(req, res, next) { res.send('hello world'); }) For comparison, flask: @app.route("/", method='GET') def hel…
I agree for the most part, except comparing node/express to Rails: node's equivalent in the Ruby world would the Sinatra, which is about as succinct than node.
Re: Node.js Fundamentals: Web Server Without Dependencies
#23These days my favorite library for writing an HTTP server is micro [0] (and a few middlewares). I like how it provides a minimal, functional layer of abstraction.
Re: Node.js Fundamentals: Web Server Without Dependencies
#24Performance is also a major advantage. Express is extremely slow compared to a basic "native" API without dependencies. If you check out the results in numbers, you'll be amazed.
Re: Node.js Fundamentals: Web Server Without Dependencies
#25Performance is also a major advantage. Express is extremely slow compared to a basic "native" API without dependencies. If you check out the results in numbers, you'll be amazed.
I was testing with only a few routes though - maybe it gets slower with more (IIRC Express architecture is that all routes are run in serial, so those defined last have to go through all the previous routes first). That and I didn’t add any latency to my tests to make it like the real world - that always has an interesting effect on results. :) Maybe I should re-run those tests for fun …
[1] https://github.com/borisovg/node-web-framework/blob/master/R...
Re: Node.js Fundamentals: Web Server Without Dependencies
#26Re: Node.js Fundamentals: Web Server Without Dependencies
#27IMHO articles like this played a major role in Node's initial success. After years of working with ever-growing frameworks with huge learning curves, it was so refreshing to get your first thing running in few seconds. Felt like basic in the 1980s or PHP in the late 1990s.
IIRC before nodejs+express the req/resp/next paradigm and middleware paradigm had never been so accessible. Other frameworks had it of course, but it was often hidden behind layers of abstraction or little quibbly bits. Express gave you just what you needed for both middleware and handlers: app.get('/', function(req, res, next) { res.send('hello world'); }) For comparison, flask: @app.route("/", method='GET') def hel…
No idea if JavaScript has similar ORM
Re: Node.js Fundamentals: Web Server Without Dependencies
#28Not 100% related to the article but koa with its maybe 300 LoC is hardly a dependency. However in general nodejs projects definitely suffer from dependency bloat. I encourage anybody to try for themselves to go through node_modules in their own projects, it’s quite englightning to see the scale of the unnecessary, duplicated, reimplementated in different ways crap there. Conscious aim at shallow, minimal or no depend…
Express was the most popular at the start and after StrongLoop got acquired by IBM it made sense for everyone that express was the foundation of Node.JS.
It's sad knowing how much bloated express is and every single Node.js library uses it from Next to GraphQL server etc...
Re: Node.js Fundamentals: Web Server Without Dependencies
#29Performance is also a major advantage. Express is extremely slow compared to a basic "native" API without dependencies. If you check out the results in numbers, you'll be amazed.
Re: Node.js Fundamentals: Web Server Without Dependencies
#30Performance is also a major advantage. Express is extremely slow compared to a basic "native" API without dependencies. If you check out the results in numbers, you'll be amazed.
Please post some citations to back up your performance claims. I haven’t found strong numbers online.
According to TechEmpower benchmark[0],Node.js-MySQL is two time faster than express-mysql.
Others benchmarks of TechEmpower tend to point exactly the same result in terms of performance for express.
[0] https://www.techempower.com/benchmarks/#section=data-r17&hw=...