Skip to content

Instantly share code, notes, and snippets.

@vickonrails
Last active February 27, 2018 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vickonrails/4e46fd3e0ca2c4d4222cecaa83e5e5b9 to your computer and use it in GitHub Desktop.
Save vickonrails/4e46fd3e0ca2c4d4222cecaa83e5e5b9 to your computer and use it in GitHub Desktop.
const express = require('express'),
app = express();
//requiring the basic_router.js
app.use('/users',require('.react-router/basic_router'));
//routes
app.get('/posts/newpost',(request,response)=>{
response.send('new post');
});
app.get('/api',(request,response)=>{
response.send('API route');
});
app.listen(3000,()=>console.log('Express server started at port 3000'));
@iShiBin
Copy link

iShiBin commented Feb 27, 2018

Line 5 app.use('/users',require('.react-router/basic_router')); should be:

app.use('/users',require('./react-router/basic_router'));

You miss the / in the react-router folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment