I'm trying to create a basic website on Node.js in order to learn. I have an html with some css and js files for the site. I want to serve this pages from Node.js, so I can make ajax calls to this later.
This is the code I have so far:
var express = require("express");
var app = express();
var path = require("path");
app.get('/',function(req,res){
res.sendFile(path.join(__dirname+'/views/index.html'));
});
app.listen(3000);
console.log("Running at Port 3000");
It loads the html correctly, but it does not find the resources css/js.
How should I implement a basic web server, where I can specify the page to return with the css/js resources I need?
Or maybe the question should be, is this the correct way to make the webpage using node?