This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | |
); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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. | |
*/ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var EventEmitter = require('events').EventEmitter, | |
_ = require('lodash'); | |
/** | |
* Creates an action functor object | |
*/ | |
exports.createAction = function() { | |
var action = new EventEmitter(), | |
eventLabel = "action", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}); |