Quiver.js

Quiver is a new web framework for writing modular applications declaratively.

Quiver is written on Node.js using the latest ES6 features:

Installation

Quiver is made of many small and loosely coupled libraries. To use Quiver, you need to at least install the quiver-component package to define and export custom components.

$ npm install quiver-component

Component

Code in Quiver is organized as many small and reusable components. Here is a simple hello world handler component:

/* hello.js */
import { simpleHandler } from 'quiver-component'

export var hello = simpleHandler(
  args => 'Hello World',
  'void', 'text')

Here simpleHandler is a simplified component type.

  • args is a plain object for storing parameterized input. (i.e. query string)
  • Input type void means the handler ignores the input stream. (i.e. request body)
  • Output type text means the handler returns a string. We use the word "text" to avoid overriding reserved methods like .toString().

simpleHandler is not a HTTP handler. But it can be used for handling HTTP requests or used in many other ways.

Running Server

Traceur Compiler is required to transpile ES6 code to ES5. In addition install quiver-http to use the helper startServer() function to start up a trivial HTTP server.

/* server.js */
import { startServer } from 'quiver-http'
import { hello } form './hello.js'

// placeholder empty config
var config = { }

startServer(hello, config)
.then(server => {
  console.log('Demo server running at port 8080...')
})
.catch(err => {
  console.log('error starting server:', err)
})
$ npm install -g traceur
$ npm install quiver-http
$ traceur server.js

Quiver in ES5

All official Quiver libraries are transpiled and exported as ES5 code. You may write Quiver applications in ES5, but it is much more beneficial to code in ES6. You will find out how much cleaner it is to code in Quiver because of ES6!

Wiki

Check out the wiki for more detailed documentation.

Contributors

Author: Soares Chen

Contributions, feedback, and pull requests welcome!

License

MIT