0.2.2 • Published 10 years ago

reqq v0.2.2

Weekly downloads
4
License
MIT
Repository
github
Last release
10 years ago

Reqq

This just shows off some cool HAR stuff (Hot API Reloading)

To see it in action, open the test/index.html page in your browser and start test/server.js. Then restart test/server.js a bunch of times and look at your brower live update!

API

reqq.createServer() -> http.Server

Creates the server for updating the client.

reqq.createAPI(host: String) -> reqq.API

reqq.API.get(path: String, callback[JSON])

reqq.API.post(path: String, body: JSON, callback[JSON])

Example

// server.js

let express = require('express')
let reqq = require('reqq')

reqq.createServer()

let app = express()

// ...
// client.jsx

let React = require('react')
let reqq = require('reqq')

let API = reqq.createAPI('http://localhost:3000')

let Hello = React.createClass({
  getInitialState () {
    return { x: null }
  },
  componentDidMount () {
    API.get('/x', response => this.setState({ x: response.x }))
  },
  componentWillUnmount () {
    // MAKE SURE YOU DISCONNECT ON UNMOUNT
    API.disconnect()
  },
  render () {
    <div>x: {this.state.x}</div>
  }
})
0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago