title: How do I make my local host display data?
body: <p>My local host has refused to load the ejs page even after trying several times and after changing the port from 3000 to 8080. It only keeps loading and sometimes displays 'This page can't be reached'.
  Here's the code.</p>
  <pre><code>const express = require('express')
  const path = require('path')
  const bodyparser = require('body-parser')
  const session = require('express-session')
  const {v4:uuidv4} = require('uuid')
  
  const router = require('./router')
  
  const app = express()
  
  const PORT = process.env.PORT || 3000
  // const PORT = process.env.PORT || 8080
  
  app.use(bodyparser.json)
  app.use(bodyparser.urlencoded({extended:true}))
  
  app.set('view engine', 'ejs')
  
  //Load static assets
  app.use('/static',express.static(path.join(__dirname,'public')))
  app.use('/assets',express.static(path.join(__dirname,'public/assets')))
  
  app.use(session({
                 secret: uuidv4(),
                 resave: false,
                 saveUninitialized: true
  }))
  
  app.use('/route', router)
  
  //Home route
  app.get('/', (req,res)=&gt;{
                  res.render('base',{title: 'Login System'})
  })
  
  
  app.listen(PORT,()=&gt;{
                 console.log(`listening to request on http://localhost:${PORT}`)
  })
  </code></pre>