Skip to content

Latest commit

 

History

History
95 lines (62 loc) · 3.71 KB

logoran-vs-express.md

File metadata and controls

95 lines (62 loc) · 3.71 KB

THIS DOCUMENT IS IN PROGRESS. THIS PARAGRAPH SHALL BE REMOVED WHEN THIS DOCUMENT IS DONE.

Logoran vs Express

Philosophically, Logoran aims to "fix and replace node", whereas Express "augments node". Logoran uses promises and async functions to rid apps of callback hell and simplify error handling. It exposes its own ctx.request and ctx.response objects instead of node's req and res objects.

Express, on the other hand, augments node's req and res objects with additional properties and methods and includes many other "framework" features, such as routing and templating, which Logoran does not.

Thus, Logoran can be viewed as an abstraction of node.js's http modules, where as Express is an application framework for node.js.

Feature Logoran Express Connect
Middleware Kernel
Routing
Templating
Sending Files
JSONP

Thus, if you'd like to be closer to node.js and traditional node.js-style coding, you probably want to stick to Connect/Express or similar frameworks. If you want to get rid of callbacks, use Logoran.

As result of this different philosophy is that traditional node.js "middleware", i.e. functions of the form (req, res, next), are incompatible with Logoran. Your application will essentially have to be rewritten from the ground, up.

Does Logoran replace Express?

It's more like Connect, but a lot of the Express goodies were moved to the middleware level in Logoran to help form a stronger foundation. This makes middleware more enjoyable and less error-prone to write, for the entire stack, not just the end application code.

Typically many middleware would re-implement similar features, or even worse incorrectly implement them, when features like signed cookie secrets among others are typically application-specific, not middleware specific.

Does Logoran replace Connect?

No, just a different take on similar functionality now that generators allow us to write code with less callbacks. Connect is equally capable, and some may still prefer it, it's up to what you prefer.

Why isn't Logoran just Express 4.0?

Logoran is a pretty large departure from what people know about Express, the design is fundamentally much different, so the migration from Express 3.0 to this Express 4.0 would effectively mean rewriting the entire application, so we thought it would be more appropriate to create a new library.

How is Logoran different than Connect/Express?

Promises-based control flow

No callback hell.

Better error handling through try/catch.

No need for domains.

Logoran is barebones

Unlike both Connect and Express, Logoran does not include any middleware.

Unlike Express, routing is not provided.

Unlike Express, many convenience utilities are not provided. For example, sending files.

Logoran is more modular.

Logoran relies less on middleware

For example, instead of a "body parsing" middleware, you would instead use a body parsing function.

Logoran abstracts node's request/response

Less hackery.

Better user experience.

Proper stream handling.

Logoran routing (third party libraries support)

Since Express comes with its own routing, but Logoran does not have any in-built routing, but there are third party libraries available koa-router and koa-route for routing. Similarly just like we have helmet for security in Express, for Logoran we have koa-helmet available and the list goes on for Logoran third party available libraries.