I just created a very simple landing page. I intended to practice my node skills and try to host the static website into my local server by using node. This is my file structure:
On my mac desktop. Inside NodeWebTest:
./assests
./css
./sass
index.html
But when I try to run it with my node code, my local server just running and cannot stop. What happen? How can I fix it?
var express = require('express');
var app = express();
var path = require('path');
app.use(express.static(__dirname + '/css'));
app.use(express.static(__dirname + '/assets'));
app.get('/', function(req, res) {
// res.sendFile(path.join(__dirname + '/index.html'));
res.writeHead(200, {"Content-Type": "./index.html"});
});
app.listen(3000);