精简了上游直播源内容,仅保留个人所需的。
https://gist.githubusercontent.com/inkss/0cf33e9f52fbb1f91bc5eb0144e504cf/raw/ipv6.m3u
var MyForm = React.createClass({ | |
render: function(){ | |
return ( | |
<ValidationForm ref="form" onSubmit={ this.validates }> | |
<Input name="title" validation="required" /> | |
<Input name="age" validation="required,number" /> | |
<Input name="email" validation={ value => value.match(/\S+@\S+\.\S+/) } /> | |
</ValidationForm> | |
); | |
}, |
/* | |
So the above file here is my Full page react file. I do a couple things here: | |
- In the head, I inject my important CSS inline. | |
- In the body, I link to my commons chunk (with react, react-router, and anything that's going to be on every single page). | |
- Beneath that is the app entry file. | |
- Beneath that is a dynamically generated chunkfile, based on the current route. | |
Each of these are cachebusted with a hash, pulled from the webpack stats file. | |
*/ | |
var EventEmitter = require('events').EventEmitter, | |
_ = require('lodash'); | |
/** | |
* Creates an action functor object | |
*/ | |
exports.createAction = function() { | |
var action = new EventEmitter(), | |
eventLabel = "action", |
var express = require('express'), | |
httpProxy = require('http-proxy'), | |
app = express(); | |
var proxy = new httpProxy.RoutingProxy(); | |
function apiProxy(host, port) { | |
return function(req, res, next) { | |
if(req.url.match(new RegExp('^\/api\/'))) { | |
proxy.proxyRequest(req, res, {host: host, port: port}); |