I'm having trouble getting my browser to display the css for the app I am creating. I have looked at the same question asked by other users but have not found any of the answers to help in my situation. When I goto the page, all that is displayed is "Hello world" with no styling even though the stylesheet is linked. When I inspect the page, I get the error:
Failed to load resource: the server responded with a status of 404 (Not Found)
here's the structure of my application
.
./public
/css
/main.css
./routes
/index.js
./views
/index.html
./server.js
server.js:
const express = require('express');
const app = express();
const port = process.env.PORT || 8080;
app.use(express.static(__dirname + '/public'));
const router = require('./routes/index.js');
app.use('/',router);
app.listen(port);
console.log('connected to port: ' + port);
index.html
<!DOCTYPE html>
<html>
<head>
<link href="../public/css/main.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
</head>
<body>
<p>Hello World!</p>
</body>
index.js
var express = require('express');
var path = require('path');
var router = express.Router();
module.exports = router;
router.get('/', function(req,res){
res.sendFile(path.join(__dirname,'../views/index.html'));
});