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

sails-cubejs-glue

v1.0.0

Published

a glue for cubejs to be used in sails's action

Downloads

7

Readme

Sails CubeJS Glue

npm version Coverage Status node npm bundle size

this package is intended to make a glue for cubejs and sails framework.

With this method, you can still use sails's functionalities like policy as it is.

Installation

to install is just straight forward:

  • with npm: npm i sails-cubejs-glue
  • with yarn: yarn add sails-cubejs-glue

Example Action

this is lazy method, that do everything one the action. (bootstrap and proxying).

Althought its better idea to use sails's hook for bootstrapping and action only proxying, this example is enough:

ON api/controllers/cube.js:

/* api/controllers/cube.js */

var glue = require('./sails-cubejs-glue');

var cubeApp = null;
const schemas = [
  {
    fileName: 'Orders.js',
    content: `
      cube('Orders', {
        sql: 'SELECT * FROM orders',
        measures: {
          countAll: {
            type: 'count'
          },
        }
      });
    `
  }
]


module.exports = async (req, res) => {
  if (cubeApp === null) cubeApp = await glue.bootstrap(schemas, {basePath: '/cube'});

  glue.createProxy(cubeApp)(req, res);
}

ON config/routes.js add the graphql route:

module.exports.routes = {
  ...
  '/cube/*': { action: 'cube' },
};

Connecting to Database

As cubejs's documentation: https://cube.dev/docs/connecting-to-the-database.

Example in environment variables:

CUBEJS_DB_TYPE=mongobi
CUBEJS_API_SECRET=123123
CUBEJS_DB_HOST=localhost
CUBEJS_DB_PORT=3307
CUBEJS_DB_USER=
CUBEJS_DB_PASS=
CUBEJS_DB_NAME=app

Drivers Dependencies

quoted from @cubejs-backend/server-core/core/index.js

const DriverDependencies = {
  postgres: '@cubejs-backend/postgres-driver',
  mysql: '@cubejs-backend/mysql-driver',
  mssql: '@cubejs-backend/mssql-driver',
  athena: '@cubejs-backend/athena-driver',
  jdbc: '@cubejs-backend/jdbc-driver',
  mongobi: '@cubejs-backend/mongobi-driver',
  bigquery: '@cubejs-backend/bigquery-driver',
  redshift: '@cubejs-backend/postgres-driver',
  clickhouse: '@cubejs-backend/clickhouse-driver',
  hive: '@cubejs-backend/hive-driver',
  snowflake: '@cubejs-backend/snowflake-driver',
  prestodb: '@cubejs-backend/prestodb-driver',
  oracle: '@cubejs-backend/oracle-driver',
};

License

MIT