
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
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 1 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
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.