npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jumbojs-master

v0.0.1

Published

JumboJS CLI and framework

Downloads

3

Readme

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 = require('./mvc')(app);

app.get('/', function (req, res) {
  res.render('index', { title: 'My jumbo pug page' });
});

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 } = require('jumbojs/framework');
const { mysql } = databases;

// instancing a connection
const conn = mysql.createConnection({
  host: 'localhost',
  user: 'root',
  password: '',
  database: 'myDatabaseName'
});

module.exports = {
  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 } = require('./mysql.conn.js');

// making a query
mysql.query(conn, 'SELECT * FROM users', (res) => {
  return console.log(res);
});

// clossing connection
mysql.close(conn);

Firebase

Using firebase driver, create new project and get web sdk in Firebase Console.

const { databases } = require('jumbojs/framework');
const { firebase } = databases;
const {
  fb,
  initiliaze,
  get,
  set,
  remove
} = firebase;

// your firebase sdk config object
const myFireBaseSDK = require('./myFireBaseSDKFile');

// init your firebase app
const fbInit = initialize(fb, myFireBaseSDK);

// set data in your real-time database
set(fb, '/users', {
  1: {
    name: 'foo'
  }
});

// get your real-time database data
get(fb, '/users', users => {
  return console.log(users);
  /*
    {
      1: {
        name: 'foo'
      }
    }
  */
});

// remove data from real-time database
remove(fb, '/users');

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 } = require('jumbojs/framework');
const { now } = utils;

console.log(now());
/*
  returns a object
  {
    day,
    month,
    year,
    time: this string contains hour:mins:secs
  }
*/

Request

Make a request for another url.

const { utils } = require('jumbojs/framework');
const { request } = utils;

// get request
request({
  method: 'get',
  baseUrl: 'https://some-domain.com/api',
  url: '/users'
}, response => {
  console.log(response);
});

// post request
request({
  method: 'post',
  baseUrl: 'https://some-domain.com/api',
  url: '/user/create',
  data: {
    name: 'Otter',
    foo: 'JumboJS'
  }
}, response => {
  console.log(response);
});

License

MIT - see LICENSE