JumboJS CLI and framework
A CLI and framework called JumboJS. This package optimize time of creating express api core and middleware routes.
Install JumboJS CLI
$ npm i -g jumbojs
Creating a app
To create a new jumbo app type:
$ jumbo new <appName> <appType> <appPort>
App type is the type of aplication api or mvc, type 'mvc' to create a model view controller app or type 'api' to create a micro-service.
The default app port is 8000.
Starting your app
To start your app type:
$ cd <appName>$ npm install$ npm start
And check in your browser "http://localhost:appPort/api".
Do not want create a API use views and make a MVC project
To create view in project type:
$ jumbo view <viewName>
and apply in your app.js to use views, like:
const init = app; app;
and try this path "http://localhost:appPort/" without api endpoint.
Creating a new app route
To create new route in your app, you must to enter in app folder and type:
$ jumbo route <routeName>
And your route as created in "./src/routes/.js".
Using JumboJS framework
Databases
MySQL
Creating a mysql connection, making a query and close connection.
const databases = ;const mysql = databases; // instancing a connectionconst conn = mysql; moduleexports = mysql: mysql conn: conn
or use CLI to make this file for your
$ jumbo database mysql
now configure your options in createConnection method and make your model
const mysql conn = ; // making a querymysql; // clossing connectionmysql;
Firebase
Using firebase driver, create new project and get web sdk in Firebase Console.
const databases = ;const firebase = databases;const fb initiliaze get set remove } = firebase; // your firebase sdk config objectconst myFireBaseSDK = ; // init your firebase appconst fbInit = ; // set data in your real-time database; // get your real-time database data; // remove data from real-time database;
Controllers
When you have create a model to use your database, try to create a controller.
$ jumbo controller <controllerName>
Set your controller name equals they model name, for User controller type user and the CLI make the first letter uppercase in the file.
This file is created in './src/controllers' folder.
THIS FILE IS A JAVASCRIPT CLASS "OBJECT"
Utils
Time
How to get data timestamp???
const utils = ;const now = utils; console;/* returns a object { day, month, year, time: this string contains hour:mins:secs }*/
Request
Make a request for another url.
const utils = ;const request = utils; // get request; // post request;
License
MIT - see LICENSE