http://localhost:3000/css/styles.css gives me:
Cannot GET /css/styles.css
.
├── public
├── css
│ ├── styles.css
│─── app.js
│─── signup.html
linked my public static files over, but when i run the node server, the css doesnt seem to apply to my html. I have attached screenshots of running it locally in static vs on node port 3000.
Hope someone could help me out.
MY app.js
const express = require("express");
const https = require("https");
const path = require("path");
const app = express();
app.use(express.static("public")); //indicates the directory for static items e.g css
app.get("/", function(req,res){
res.sendFile(__dirname + "/signup.html");
});
app.listen(3000, function(){
console.log('server is running on port 3k');
})
my html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sign up for newsletter</title>
<link href="css/styles.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<div class="wrapper fadeInDown">
<div id="formContent">
<div>
<h1>Sign up to get the latest updates!</h1>
</div>
<!-- Tabs Titles -->
<!-- Icon -->
<div class="fadeIn first">
<img src="https://natisaver.github.io/cv/images/mugicon.png" id="icon" alt="User Icon" />
</div>
<!-- Login Form -->
<form>