title: Can't setup simple Node.js server
body: <p>I am super new to Node.js and the whole back end in general.
  I am trying to set up simple node.js server to create authorization(admin, user) nothing special I guess.
  When I try just to enter my server in browser using localhost:5000
  I get this error.</p>
  <pre><code>localhost/:1 GET http://localhost:5000/ 404 (Not Found)
  </code></pre>
  <p>Same story when using http://localhost:5000/auth/login or any other routing.
  The weird part is that at the same time I am always getting message<code>server started on port 5000</code> in VSC terminal.</p>
  <p>And also few times somehow I managed get message
  <code>REG</code>  in VSC terminal.</p>
  <pre><code>router.get('/registration', async () =&gt; {
      console.log('REG')
  })
  </code></pre>
  <p>But in browser console I am getting same error<code>Failed to load resource: the server responded with a status of 404 (Not Found)</code></p>
  <p>Please find my code attached below.<br>
  server.js</p>
  <pre><code>const express = require('express');
  const mongoose = require('mongoose');
  const authRouter = require('./authRouter')//yes
  const PORT = process.env.PORT || 5000;
  const connectionString = 'mongodb+srv://Ivan:aldaron1@cluster0.fivve.mongodb.net/usersBD?retryWrites=true&amp;w=majority'//yes
  const app = express();
  app.use(express.json());
  app.use(authRouter);
  const start = async () =&gt; {
      try {
          await mongoose.connect(connectionString)
          app.listen(PORT, () =&gt; console.log(`server started on port ${PORT}`))
      } catch (error) {
          console.log(error)
      }
  }
  
  start()
  </code></pre>
  <p>authController.js</p>
  <pre><code>class authController {
      async registration(req, res) {
          try {
              res.json(&quot;server works&quot;)
              console.log(&quot; 123 &quot;)
          } catch (e) { }
      }
      async login(req, res) {
          try {
              res.json(&quot;server works&quot;)
              console.log(&quot; 123 &quot;)
          } catch (e) { }
      }
      async getUsers(req, res) {
          try {
              res.json(&quot;server works&quot;)
              console.log(&quot; 123 &quot;)
          } catch (e) { }
      }
  
  }
  
  module.exports = new authController();
  </code></pre>
  <p>authRouter.js</p>
  <pre><code>const Router = require('express')
  const router = new Router()
  //const controller = require('./authController')
  
  
  router.get('/registration', async () =&gt; {
      console.log('REG')
  })
  router.get('/login', async () =&gt; {
      console.log('REG')
  })
  //router.post('/login',)
  //router.get('/users', controller.getUsers)
  
  module.exports = router
  </code></pre>
  <p>package.json</p>
  <pre><code>{
    &quot;name&quot;: &quot;node-server-ivan&quot;,
    &quot;version&quot;: &quot;1.0.0&quot;,
    &quot;description&quot;: &quot;my first node.js server&quot;,
    &quot;main&quot;: &quot;index.js&quot;,
    &quot;scripts&quot;: {
      &quot;test&quot;: &quot;echo \&quot;Error: no test specified\&quot; &amp;&amp; exit 1&quot;
    },
    &quot;author&quot;: &quot;&quot;,
    &quot;license&quot;: &quot;ISC&quot;,
    &quot;dependencies&quot;: {
      &quot;body-parser&quot;: &quot;^1.19.0&quot;,
      &quot;express&quot;: &quot;^4.17.1&quot;,
      &quot;mongodb&quot;: &quot;^3.6.3&quot;,
      &quot;mongoose&quot;: &quot;^5.11.15&quot;,
      &quot;node&quot;: &quot;^15.8.0&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;nodemon&quot;: &quot;^2.0.7&quot;
    }
  }
  </code></pre>
  <p>Any thougs why it like that?</p>
  <p>Thank you in advance!</p>