-
-
Save amandeepmittal/67617e47fd09ccab2a39234969c1480e to your computer and use it in GitHub Desktop.
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
// routes/index.js | |
const router = require('express').Router(); | |
const bookRoutes = require('./books'); | |
const path = require('path'); | |
// API routes | |
router.use('/api/books', bookRoutes); | |
// If no API routes are hit, send the React app | |
router.use(function(req, res) { | |
res.sendFile(path.join(__dirname, '../client/build/index.html')); | |
}); | |
module.exports = router; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment