title: Can't app.use two different routers in my index.js file
body: <p>Hi there I am trying to create a react app and I am having trouble with the backend.</p>
  <p>I have an index file like this</p>
  <pre><code>const express = require('express')
  const bodyParser = require('body-parser')
  const cors = require('cors')
  
  const db = require('./db')
  const bookRouter = require('./routes/book-router')
  const userRouter = require('./routes/user-router')
  
  
  
  const app = express()
  const PORT = process.env.PORT || 8174
  
  app.use(bodyParser.urlencoded({ extended: true }))
  app.use(cors())
  app.use(bodyParser.json())
  app.use(express.json())
  
  db.on('error', console.error.bind(console, 'MongoDB connection error:'))
  
  
  app.get('/', (req, res) =&gt; {
      res.send('Hello People!')
  })
  
  
  //set up routes
  app.use('/api', bookRouter) // the issue is here
  app.use('/user', userRouter)
  //commenting one of these lines makes the app work
  
  app.listen(PORT, () =&gt; console.log(`Server running on port ${PORT}`))
  </code></pre>
  <p>so the reason my app is not working is at fault of the app.use if I comment one of them out the server runs fine, but if I leave them both in the file not commented out then they app will crash with this error</p>
  <pre><code>events.js:174
        throw er; // Unhandled 'error' event
        ^
  
  Error: listen EADDRINUSE: address already in use :::8174
      at Server.setupListenHandle [as _listen2] (net.js:1280:14)
      at listenInCluster (net.js:1328:12)
      at Server.listen (net.js:1415:7)
      at Function.listen (/home/devinshawntripp/unt-library-system/server/node_modules/express/lib/application.js:618:24)
      at Object.&lt;anonymous&gt; (/home/devinshawntripp/unt-library-system/server/index.js:30:5)
      at Module._compile (internal/modules/cjs/loader.js:778:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
      at Module.load (internal/modules/cjs/loader.js:653:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
      at Function.Module._load (internal/modules/cjs/loader.js:585:3)
      at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
      at startup (internal/bootstrap/node.js:283:19)
      at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
  Emitted 'error' event at:
      at emitErrorNT (net.js:1307:8)
      at process._tickCallback (internal/process/next_tick.js:63:19)
      at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
      at startup (internal/bootstrap/node.js:283:19)
      at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
  [nodemon] app crashed - waiting for file changes before starting...
  </code></pre>
  <p>Any help would be amazing, thank you!</p>