0

i am making a server in express that rendering an html pages

onst express = require('express');
const server = express();
const path = require('path');
//const WebSocket = require('ws');
const port = 8088;

server.use(express.static(path.join(__dirname, 'static')));
server.set('view engine',"ejs");
server.get('/emulator',(req,res)=> {
  console.log(req.url);
  res.render('app');
  res.end();
})

it work when i send this request http://localhost:8088/emulator but when i add "/" in the end like this http://localhost:8088/emulator/ just the html page appears whithout the css,js this how i call the static files in the html page

<link rel="stylesheet" href="css/style.css">
<script src="js/main.js"></script>

0 Answers0