In the past weeks i've been busy with the developement of the Xiara Application Framework.
Xiara is a framework for building efficient, scalable Node.js server-side applications. It uses modern JavaScript, is built with TypeScript (preserves compatibility with pure JavaScript) and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).
Under the hood, Xiara makes use of Express, allowing for easy use of the myriad third-party plugins which are available.
Xiara also features mongodb support out of the box
The framework is split up between multiple repositories:
https://github.com/azarus/xiara-core
https://github.com/azarus/xiara-web
https://github.com/azarus/xiara-mongo
And a boilerplate quickstart project:
https://github.com/azarus/xiara-boilerplate
collection.match().where().group() and so on)A xiara web application with express & mongo is built up with the following components:
Modules: Are the root of the application
Submodules: Are the same as modules can import and export components
@Controller("/route")
class TestAPIController
{
@GET("/getData")
getData(req, res)
{
res.json({
success: true
})
}
}
The above route defines the following HTTP end point
GET /route/getData
@Policy("Auth")
class AuthPolicy
{
resolve(req, res, next)
{
// If logged in continue
if(req.user)
{
return next();
}
res.forbidden("Login required");
}
}
@Response("forbidden")
class ForbiddenResponse
{
constructor(public message: string)
{
}
send(req, res, next)
{
return res.json({
success: false,
message: this.message
})
}
}
Xiara-Core
https://github.com/azarus/xiara-core/commit/f4f2feaf39c9f24bc2c3e3cee7f8c3f77ac54208
https://github.com/azarus/xiara-core/commit/32e321bc30d5931e493910fc70c912cbc7f05e65
Xiara-Web
https://github.com/azarus/xiara-web/commit/2612670b19bc836058b8ac5d949321d5693e20c0
Mit
Please open an issue on github:
https://github.com/azarus/xiara-core