Knoten JS Startvorlage

/*
Terminal Commands:
npm init
npm install express
*/

//index.js commands:
const express= require('express');
const app= express();

app.use(express.static(__dirname));     //server css file as static otherwise css won't be seen in index.html when sent through sendFile()

//handling get request for home route
app.get("/",function(req,res){     
  res.sendFile(__dirname+"index.html");
});

//handling post request for home route
app.post("/",function(req,res){
	res.send("Post request Recieved!");
});

//makes the server to reserve port 3000 for this application
app.listen("3000",function(){
	console.log("Server running on port 3000");
});
                   

Obnoxious Ox