1.2.0 • Published 7 years ago

deceit v1.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

DECEIT


Deceit is made for mimicking REST services and complex data relationships. Deceit replaces heavy development environments and helps applications grow quickly.

DECEITFUL SERVERS & GENERATORS


Deceit currently has two main utilities:

The first is creating serviced REST endpoints quickly. Deceitful services can use any REST verb and automate parameter injection for handler functions.

// This runs a server with an 
// endpoint which concats strings.
deceit.serve({
    "/concat": function(prefix, suffix){ 
        return prefix + suffix 
    }
});

The second is generating mock data. Deceitful generators can mimic objects of arbitrary complexity. They can also simulate relationships between objects (eg. shared database keys).

// generates 50 "Names"
var names = deceit.gen([{
    first: /[A-Z][a-z]{4,7}/,
    last: /[A-Z][a-z]{4,7}/,
    middle: /[A-Z]/
}, 50])

Documentation


Rudimentary documentation for Deceit is hosted here. Better documentation complete with examples and samples should arrive soon. For now, use the file "test.js" in the deceit module as a reference for creating intricate templates.

MOTIVATION & USE CASES


I created Deceit to speed up the development of client-side code which interacts with large servers. Most client-side software depends on information retrieved from servers, so testing the client-side code requires running servers. Often, those servers are in turn dependent on other servers and databases. So, testing new UI features requires configuring and running a full stack of software.

Deceit aims to replace sprawling server environments with lightweight, self-contained facsimiles. Test data for client-side code doesn't need to be persistent across sessions- it just needs to follow the same patterns that real data would. So, Deceit provides compact, expressive tools for generating plausible data and serving it.

There are a few situations where these "deceitful servers" can boost productivity:

  • When building new apps, deceitful servers can be extended to experiment with new REST routes in minutes. Servers retrieving data from persistence layers are, with good reason, less nimble.

  • Alternatively, deceitful servers can save time on configuration. If switching between projects often, system settings and version conflicts can become time-sinks. Deceitful servers are agnostic to these needs, and can even run in parallel.

  • Building on the last example, deceitful servers are portable. They run anywhere Node does, and can be transferred quickly. Collaborators can share and run code more easily on more devices using deceitful servers.

INSTALLATION


Deceit is best used as a local npm package:

> npm install deceit --save

FUTURE PLANS


Deceit is very young and still growing. More documentation is a priority and should arrive shortly. There are also plans to add more built-in templates using Chance.js, build in configurable chaos for robustness testing, and refine the template process.

If you have any feature requests, get in touch- I'm sure others will find those same features helpful.

LICENSE


Deceit is free to use on an MIT license!