
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
react-collider
Advanced tools
Express middleware for isomorphic express + react apps.
Check out the daily-collider branch for a working example, including data-fetching from the Dailymotion API.
$ npm install --save react-collider
Simply add the server middleware in your express app, giving your routes and the path to the components.
var express = require('express'),
path = require('path'),
app = express(),
port = process.env.PORT || 3000,
collider = require('./collider').server,
routes = require('./routing')
app.use(collider(routes, path.join(__dirname, './components')))
app.listen(port, function() {
console.log('Listening on 127.0.0.1:' + port)
})
Similar: call the client module with your routes and the components' path.
var path = require('path'),
collider = require('./../collider').client,
routes = require('./routing')
collider(routes, path.join(__dirname, './components'))
Your components must have a mandatory getModulePath
static method, which must return a string giving the path to the module, relative to the component path.
If your component must fetch some data before being rendered, use a fetchData
static method. It must return a promise.
Example of a simple component:
var Home = React.createClass({
statics: {
getModulePath: function() {
return 'home/home'
},
fetchData: function() {
// returns a promise
return getHomeData()
}
},
render: function() {
var videos = getVideoList()
return (
<div>
<h1>Homepage</h1>
{videos}
</div>
)
}
})
FAQs
Express middleware for isomorphic express + react apps
The npm package react-collider receives a total of 3 weekly downloads. As such, react-collider popularity was classified as not popular.
We found that react-collider demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.