Quiver is a new web framework for writing modular applications declaratively.
Quiver is written on Node.js using the latest ES6 features:
- ES6 compiled to ES5 using Traceur Compiler
- Promise based async control flow
- Generator support on top of promises
- ES6 Modules and Class syntax
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
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.
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
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!
Check out the wiki for more detailed documentation.
Author: Soares Chen
Contributions, feedback, and pull requests welcome!