Express-Sequelize Wrapper
An express wrapper using sequelize
Resources
- Api Reference (In progress)
- Step-by-step tutorial to setup a simple server (In progress)
Features
- An easy way to setup a server
Installation
npm install express-sequelize-wrapper
Simple app
Create a new app with AppWrapper.App
module, and add below code to your app.js
file
var AppWrapper = App = AppWrapperApp app; app = ;
Set database
To setup database use .setDatabase()
method, it recieves database basic configuration and models.
app;
Add route
You can add routes using .addRoute()
method, it gets a function that recieves depencencies and returns the route configuration
app;
Install sub-app
You can also install other apps
Sub App installer
The installer function have can have path
and parent
parameters or just parent
parameter, all paths inside sub-app are set after path
.
// Using pathvar { // Sub-app var subApp = pathparent; // Sub-app route subApp;}; // Without pathvar { // Sub-app var subApp = parent; // Sub-app route subApp;};
Installing sub-apps
To install sub-app use .install()
method
// Using pathapp;// Without using pathapp;
Start and stop server
To start server use .start()
method
appstart;
And stop server using .stop()
method
app;