-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
55 lines (36 loc) · 1007 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const http = require('http');
const fs = require('fs');
const _ = require('lodash');
const express = require('express');
const app = express();
// testing a package
//let example = _.fill([1,2,3,4,5], "banana",1,4);
//console.log(example);
app.get('/', (req, res) => {
res.send('Hello World');
});
app.get('/example', (req,res) => {
res.send('hitting example route');
});
app.get('/example/:name/:age',(req,res)=> {
console.log(req.params);
res.send('example with route params');
})
app.listen(3000);
/*
const server = http.createServer((req, res) => {
//reading static resources
const readStream = fs.createReadStream('./static/index.html');
res.writeHead(200,{'Content-type' : 'text/html'});
readStream.pipe(res);
// check domain
if(req.url === '/'){
res.write('Hellow world from nodejs');
res.end();
}
else{
res.write('using some other domain');
res.end();
}
});
server.listen('3000');*/