Someone asked me: what can he gain from aex over express.js?
It is a very good question and it can also be the reason why the aex framework comes into existence.
Although most Node.js developers use expressjs as their base web server framework and ExpressJs has a very good community and a lot of middlewares existed, it is still lack some important features web developers may need. This makes expressjs web development more difficult and chaotic when projects grow.
So I would like to introduce the new web framework for node.js web development: the aex web framework, and its gains over expressjs to see how aex ease the way for node.js web server developers:
Focus on your own business instead of web processing.
Aex enables Object Oriented Web development in node.js. And only focus on web processing, so you can focus your time on your business instead of how to handle web requests.
class Factory {
public name: string;
constructor() {
this.name = "Aex Factory";
}
@get("/factory/name")
public async getName(req, res, scope) {
res.end(this.name);
}
}
Here you, only need to focus on your business factory. Http processing can be silently done out side of your business class's member functions.
Simplified Web processing tools with decorators.
http requests, error handling, data filtering and file uploading, etc.
for example a simplified file upload:
import { http, formdata } from "@aex/core";
class Formdata {
protected name = "formdata";
@http("post", "/file/upload")
@formdata()
public async upload(req, res, scope) {
const { files, body } = scope;
// Access your files
const uploadedSingleFile = files["fieldname1"][0];
const uploadedFileArray = files["fieldname2"];
// Access your file info
uploadedSingleFile.temp; // temporary file saved
uploadedSingleFile.filename; // original filename
uploadedSingleFile.encoding; // file encoding
uploadedSingleFile.mimetype; // mimetype
// Access none file form data
const value = body["fieldname3"];
res.end("File Uploaded!");
}
}
Separating Web Processing from Web Data with scope
Object
Aex provide a global variable -scope
, per request for every process to store, retrieve and pass data to its following process.
Compatible with most reentrant express middlewares.
about 15% performance improvement over express 4.x.
Here is the benchmark tests: https://github.com/aex-ts-node/benchmark
A new theory: the Web Straight Line theory over MVC theory.
MVC is not a proper theory for web frameworks.
There are at lease two types web frameworks: 1. web processing frameworks, 2. web application frameworks.
the Web Straight Line theory is for the web processing frameworks, not for web application frameworks where MVC has its place.
You may find more here.
Top comments (0)