Reasons You may Upgrade to Aex from Expressjs

李白字一日
3 min readMar 24, 2021

Expressjs hasn’t been updated for years.
It has missed some very important features to ease the way we code.
If you want to build a web project without tackling annoying regular web processing, You may want to give aex a try.

Here are the main reasons:

1. Built-in Promise/await/async support with middlewares

Aex defaults all handlers to be async/await/promised.

So you don’t need any callback in middlewares.

The simplest middleware form:

2. Programming in an object oriented way

With async/await/promise, we can eliminate callback hell.
With decorators, We can have better and simpler form to program in an object oriented way.
Expressjs Programs can not handle routes in an object oriented way. But with the help of the decorator, Aex made it possible.

You can pass parameters to classes to initialize them as well.

3. Passing data through the request flow for both global/outer and inner usage.

Aex replace next function with an undismissable variable scope to store many types of data: body , query , param , extracted , error , debug , etc. You may look here for a whole list of data that scope currently supported.

You can also get http processing time with ease from scope:

To get the requesting time:

To get the passed time:

scope is very useful when you need to pass data.

4. Ease the web process with less and cleaner code

For if you want to get uploaded files’ info, You can use @formdata to handler all uploaded files and other form data :

5. Built-in error handling

With @error you can simplify the way error being defined and used, and with built-in i18n support.

6. Simplified WebSocket handling

Aex comes with built-in support for websocket.
It is very easy to handle websocket.

7. Faster request processing speed

Aex is about 15% faster than expressjs for initial http requests. You can check the benchmark testing result here

8. Compatibility with expressjs

Aex is compatible with most express middlewares if they are not coupled with expressjs.

9. Compatibility with http req, res

Aex almost keeps the http req , res objects intact. So there is no name pollution or somthing in them, all packages based on http package can be reused in aex.

10. Embrace Web Straight Line and no MVC

Aex is designed according to the web logic, which is named The Web Straight Line.

With Web Straight Line, we can see clearly how web requests can be processed, what processes should be modularized and reused.
Aex is also reenterant and pluggable.
And it is not an MVC framework, it is a Web Straight Line implementation in node.js

Web request handlings are none mvc processes. So we will not introduce MVC in aex.
It is just logic and data process.
But this does mean that your project are none mvc.
It is OK to use MVC in your project. But web frameworks don’t need it.

These are the most import reasons you may upgrade to aex.

Which reason can be the strongest one for you?

Originally published at https://dev.to on March 24, 2021.

--

--