Skip to content

Commit 8969d1a

Browse files
Initial commit
0 parents  commit 8969d1a

File tree

5 files changed

+2935
-0
lines changed

5 files changed

+2935
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

app.js

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
2+
var express = require("express");
3+
const path = require('path');
4+
const cfenv = require('cfenv');
5+
6+
var app = express();
7+
var appEnv = cfenv.getAppEnv();
8+
var portNumber = process.env.port || 3000;
9+
var url = process.env.url
10+
app.set('port', (process.env.PORT || 5000))
11+
app.use(express.static(__dirname + '/images'))
12+
13+
/*
14+
app.get("/getCall", function(req,res){
15+
console.log("GET Method caled");
16+
console.log(__dirname);
17+
18+
res.send("<h2>Welcome to Node JS express app</h2>"+appEnv.url+appEnv.port+port+process.env.LOGNAME);
19+
20+
}).listen(9009);
21+
console.log(__dirname+"/images/mithunlogo.jpg");
22+
*/
23+
app.get('/mithuntechnologies', function(request, response) {
24+
//response.send("<h2><center>Welcome to Node JS app</h2>");
25+
response.write("<h2><center><u>Node JS Application </u></center></h2>");
26+
27+
response.write("<h2><center>Welcome to Mithun Technologies. Please Contact +91-9980923226 for more information or send an email to [email protected] <center></h2>" );
28+
response.end();
29+
30+
})
31+
32+
33+
//app.get("/html", function(req,res){
34+
app.get("/html", function(req,res){
35+
res.set("Content-Type","text/html");
36+
//res.contentType("html") ;
37+
res.write("<h2>Welcome</h2>");
38+
res.write("<h2>/html call</h2>");
39+
//must end
40+
res.end();
41+
42+
});
43+
app.get("/jsonData", function(req,res){
44+
res.type('json');
45+
//res.type('application/json');
46+
//res.json({'name': 'Mithun Reddy L'});
47+
res.send({'name': 'Mithun Technologies',
48+
'technology': 'DevOps'
49+
});
50+
51+
});
52+
app.get("/queryparam", function(req,res){
53+
//res.send(req.query);
54+
res.send(req.query.key + ": " + req.query.name);
55+
});
56+
57+
app.get("/status-code-404", function(req, res) {
58+
//set content-type to application/json
59+
//res.sendStatus(404);
60+
res.status(404).send('Sorry, we cannot find that!');
61+
})
62+
63+
app.get("/status-code-500", function(req, res) {
64+
//set content-type to application/json
65+
//res.sendStatus(500);
66+
res.status(500).send('Internal Server Error – custom message');
67+
})
68+
69+
app.get('/redirect', function(req, res) {
70+
//Send status 300
71+
res.redirect('http://mithuntechnologies.com');
72+
});
73+
74+
75+
app.listen(app.get('port'), function() {
76+
console.log("Node JS app is running at http://localhost:" + app.get('port') +"/mithuntechnologies");
77+
})
78+
79+
80+
81+
82+

images/mithunlogo.jpg

10.7 KB
Loading

0 commit comments

Comments
 (0)