ibm-india-rajtgin
Version:
This is my IBM Oct training module
44 lines (32 loc) • 976 B
JavaScript
/**
* Created by Raj on 10/25/2016.
*/
var express = require("express");
var app = express();
var port = 2525;
//default port of express is 3000
//var listen = app.listen();
//console.log("Navigate to http://localhost:" + listen.address().port);
app.get("/", function(req,res){
res.send("<h1> welcome to Raj's page</h1>")
});
app.get("/ibm", function(req,res){
res.send("<h1> welcome to ibm page</h1>")
});
app.get("/product", function(req,res){
res.send("<h1> welcome to product page</h1>")
});
app.get("/product/:type", function(req,res){
var type = req.params.type
res.send("<h1> welcome to " + type + " product page</h1>")
});
app.get("*", function(req,res){
res.send("<h1> This page is not available</h1>")
});
app.listen(port, function(error){
if(error) {
console.log("something went wrong")
}else {
console.log("You can access the server @ port " + port)
}
})