MCPcopy
hub / github.com/wdjungst/react-project / handleServerRoute

Function handleServerRoute

modules/PublicServerAPI.js:136–152  ·  view source on GitHub ↗
(req, res, route, props)

Source from the content-addressed store, hash-verified

134}
135
136function handleServerRoute(req, res, route, props) {
137 const handler = route[req.method.toLowerCase()]
138 if (!handler) {
139 res.status(500).send(renderToStaticMarkup(
140 <ErrorMessage>
141 <p>
142 Route has no handler. Add "get", "post" etc.
143 </p>
144 <pre>{'<Route get={handler}/>'}</pre>
145 <p>Route Props:</p>
146 <pre>{Object.keys(route).join(' ')}</pre>
147 </ErrorMessage>
148 ))
149 } else {
150 handler(req, res, route, props)
151 }
152}
153
154function onError(err, req, res) {
155 res.status(500).send(renderToStaticMarkup(

Callers 1

sendWithReactRouterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected