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

ryuu-server-beta

v0.1.0

Published

Easy, low profile, koa server/proxy to allow for data calls to Domo. Uses your current `domo login` info for authentication. `domo dev`s backend with your own front end bundler.

Downloads

19

Readme

Ryuu Server

Easy, low profile, koa server/proxy to allow for data calls to Domo. Uses your current domo login info for authentication. domo devs backend with your own front end bundler.

  • Install
npm install ryuu-server-beta --save-dev
  • For webpack builds Webpack 2+, node 6.10.3+

only use this if you know how webpack works and have configured a webpack server before

Install koa-webpack, which enables the koa server to mingle with the express server.

 npm install koa-webpack --save-dev

Adjust your server initialization file to look like the following:

// whichever file you normally initialize your webpack server
const webpack = require('webpack');

const ryuuServer = require('ryuu-server-beta');

// webpackConfig here is being imported 
const compiler = webpack(webpackConfig);

const RyuuDevServer = require('koa-webpack');

the rest of the server file can follow the pattern from below, but feel free to change some values if you know it won't affect koa-webpack:

const path = require('path');
const portfinder = require('portfinder');
//you could import these configs below like I have done in the beginning of  
//this file, showing here to easier see what they should resemble

const devConfig = {
    contentBase: path.join(process.cwd(), 'dist'),
    publicPath: '/',
    clientLogLevel: 'error',
    noInfo: false, // set to false if you want to see build info
    stats: {
        colors: true
    },
};
// if you dont care about HMR, do not worry about adding a hot cofnig
const hotConfig = {
    log: console.log,
    path: '/__webpack_hmr',
};
//you can put it on any port you want, just make sure you change your entry property in your webpack config to reflect the port number
portfinder.basePort = 3000;
//notice a slightly different schema for this dev server compared to a       //regular webpack-dev-server
const middleware = RyuuDevServer({ compiler, dev: devConfig, hot: hotConfig });
//here we pass the koa-webpack compiler to the ryuu server  
ryuuServer.use(middleware);
//ryuu-server-beta has a single custom method, .sessionCheck(), that ensures //you are properly authenticated to a domo instance. It returns a promise    //that you can wait for to eventually spin up the ryuuServer through the     //native .listen() method.

ryuuServer.sessionCheck().then(() => {
    portfinder.getPort({
        host: '0.0.0.0'
    }, (err, port) => {
        ryuuServer.listen(port || 3000, '0.0.0.0', () => {
            console.log('Listening on http://0.0.0.0:' + port + '/');
        });
    });
});

If you want hot reloading, add 'webpack-hot-middleware/client?http://0.0.0.0:3000/__webpack_hmr&reload=true' into the entry array. This connects to the server to receive notifications when the bundle rebuilds and then updates your client bundle accordingly.

Be sure to be domo logind to an instance. Then in your /src dir, make sure to have a valid manifest.json to retrieve datasource and alias information from. If you dont have a /src folder, and store your manifest.json elsewhere, change the ryuuServer.options.manifestDir prior to your .sessionCheck(), where the manifest.json is actually retrieved.

Now, run npm start, go to the url it logs, and you should have working /data/v1/ calls routing through your webpack build.

Other build tools

If you have are using a build tool other than webpack, configuration should be fairly simple. Webpack is definitely the most complex for integration. Please drop an issue if you need help implementating another.

Requests

This is a work in progress. Your feedback is needed to know what would be a desired addition, feature, or change. Please log an issue or better yet, submit a PR.