# rediserve

> This is a Redis client wrapper for working with lightning fast EmberJS deployments and workflows.

Latest version **0.2.0** (published 2016-10-26) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install rediserve
pnpm add rediserve
yarn add rediserve
bun add rediserve
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2016-10-26 |
| First published | 2016-10-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Christian Gaetano |
| Maintainers | cgatno |
| Keywords | redis, ember, lightning, deploy |

## Links

- npm: https://www.npmjs.com/package/rediserve
- Repository: https://github.com/cgatno/rediserve
- Homepage: https://github.com/cgatno/rediserve#readme
- Issues: https://github.com/cgatno/rediserve/issues
- npm.io page: https://npm.io/package/rediserve

## Dependencies (1)

- [redis](https://npm.io/package/redis.md) ^2.6.2

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2016-10-26
- 0.1.2 — 2016-10-26
- 0.1.1 — 2016-10-26
- 0.1.0 — 2016-10-25
- 0.0.2 — 2016-10-25
- 0.0.1 — 2016-10-25

## README

rediserve - a lightning fast Redis interface for EmberJS deployments
=========================

[![GitHub version](https://badge.fury.io/gh/cgatno%2Frediserve.svg)](https://badge.fury.io/gh/cgatno%2Frediserve) [![npm version](https://badge.fury.io/js/rediserve.svg)](https://badge.fury.io/js/rediserve)

This is a Redis client wrapper for working with lightning fast EmberJS deployments and workflows.

Install with:

    npm install rediserve

Before going any further, I have to give a __huge__ shoutout to [Matthew Ranney](https://github.com/mranney) and all of his collaborators for creating [_the best_ node Redis client](https://github.com/NodeRedis/node_redis) upon which this project heavily depends.

## Usage example

```js
// index.js
// Example node.js web app using rediserve to fetch the markup of
// index.html for an EmberJS app deployed using the lightning deploy methodology
// (see https://www.youtube.com/watch?v=QZVYP3cPcWQ for more on the deployment strategy)

// Load up our dependencies

var express = require('express');
var redis = require('redis');
var rediserve = require('rediserve');

// Initialize the Express app to use as our server

var app = express();

// IMPORTANT: connect rediserve to Redis database first
rediserve.connect({
        password: '|cuY9yjA&{LCsjLpE5G,<o'
    },
    function (eventName, eventMsg) { // define a callback to handle Redis database events
        console.log('Redis event: ' + eventName + ' (' + eventMsg + ')');
    });

// Route all other paths to get a single index.html since this is a single-page Ember app
app.get('/*', function (req, res) {
            // Specially route any requests with a url-defined rev variable (e.g. ?revision=3783dvb2386723v39)
            // WARNING: Don't do it this way for a production app! Make sure you somehow check or sanitize the
            // input from the request first!
            let desiredRev = req.query.revision;
            try {
                rediserve.getHtml({
                        appTag: 'ember-quickstart',
                        rev: desiredRev, // desiredRev will be undefined (default to current-content) or retrieved from the URL
                        callback: function(html) {
                            res.send(html);
                        }
                });
            } catch (e) {
                if (e instanceof rediserve.GetHtmlError) {
                    console.log('Could not retrieve HTML because ' + e.message);
                }
            }
});

// Start the server, listening on port 8080
app.listen(8080);
console.log('rediserve test server listening on port 8080...');
```

## How to Contribute
- Open a pull request or an issue about what you want to implement / change. I'm always looking for help to move the project forward!
 - I want this to be reliable and functional, so only submit thoroughly tested code!

## Contributors

The original author of rediserve is [Christian Gaetano](https://github.com/cgatno)

[Matthew Ranney](https://github.com/mranney) is the creator of [_the best_ node Redis client](https://github.com/NodeRedis/node_redis) upon which this project heavily depends.

## License

[MIT](LICENSE)

---
_Source: https://npm.io/package/rediserve · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
