Angel, Express JS 4 Starter Kit with taste of a Framework
Let’s Roll !
Angel is Web Application Starter for NodeJS with ExpressJS Framework. This starter built with heart of believe that development must be an easy, enjoyable and creative. This starter is inspired a lot by Laravel Framework. Angel starter attempts to take out the pain out of development using nodejs with expressjs.
Checkout on Angel Github, and for how to use it ? check documentation below :
Routing :
Angel starter routing is on folder app/routes, you can create all files of routing .js file inside folder app/routes, Angel will automatically read those files and write them as routing on expressjs. Example route file site.js :
On this route first key is declare as a method on route, and object on key are available options.
you can also add group routing, in case you need to add prefix, middleware, or even folder.
Controllers :
Controller in Angel starter is inside folder app\controllers, for example let’s just say you have this on route :
on this route it will say like this find controller method function index in class controller home inside folder site, so basically we will need class controller inside folder site. This how class controller home home.js looks like inside folder site.
Here some options in your controller that you can do
Database & Model :
Database and Model Angel Starter is still under development, not yet 100% completed.
Angel starter database driver is built with CaminteJS as core package. So it’s support many variants of database like mongodb, mysql, sqlite, etc. But for model on Angel is really difference between CaminteJS and Our Model.
You can change config database on file config/database.js
Schema
Schema in Angel starter is same as schema in CaminteJS, you can add your CaminteJS schema in folder app/schemas
Model
Model in Angel Starter is really difference with CaminteJS model, but its pretty similar with laravel framework.
In Angel Starter Model there are two relations between model class :
* BelongsTo
* HasMany
Right know only two that already complete testing and ready to use, other relation is still under testing and development.
But first, to define model class on Angel starter is really easy you can add, edit or delete file model inside folder app/models.
First paramater when calling parent constructor on class model is ‘User’, ‘User’ is define as name of your Schema in folder app/schemas, and the second paramater is subdomainname, this subdomainname is passing paramater, its use when you are using multiple subdomain as database connection. We will discuss this in single tenant application and multi tenant database that angel starter support. :)
Relation
Using three relations in Angel Model class is pretty easy you just add your relation within your model class, for example
After adding in your class model you need to calling you relation class to added within your reault of query. For example :