Api Reference
Initialize app
Installation
npm install qserver
Setup app
var qServer = App = qServerApp app = ;
Settings
.setDatabase
Like wrapper uses sequelize, so it uses Sequelize configuration. To set models, it get a function that recieves sequelize instance and data-types and return models.
app;
.addModels
.addModels
adds new models to database
app;
.setViewEngine
.setViewEngine
method sets view engine and views path, it recieves an object with attributes path
, extension
and engine
.
'path' attribute sets the views path, extension
is the file's to render extension and engine
is the view engine.
app;
.setPublicDirectory
.setPublicDirectory
method the public directory path
app;
Router
.addRoute
.addRoute
method works with dependency injection, it recieves a function with dependencies to resolve and returns the route configuration
app
Install apps
You can also compose other apps eith your main app
App installer
Tha app installer is the function that contains app to be installed, this function recieves app that will be composed (parent
).
var { // Sub-app var subApp = parent; // Sub-app route subApp;};
If app should be installed inside a costum path it also should be recived as a parameter before parent
. Route paths inside sub-app will be after path sent by installer function.
var { // Sub-app var subApp = pathparent; // Sub-app route subApp;};
.install
This is how we will install sub-apps
// Without using pathapp;// Using pathapp;
Sockets
Based on Socket.io.
.socket
Receives a function as a paramater, that function receives the io server instance
app;
Dependencies
Wrapper works with dependency injection, here we list available dependencies
$database
This is the instance of the app database