-
Notifications
You must be signed in to change notification settings - Fork 0
/
express_middleware.js
35 lines (30 loc) · 963 Bytes
/
express_middleware.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
const express=require('express');
let app =express();
const port =process.env.port || 9999;
app.use('/css',express.static(__dirname+ '/public'));
app.use((req,res,next)=>{
console.log('middleware');
next();
})
app.get('/',(req,res)=>{
res.send(`
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<meta name="viewport" content="width=device-width, user-scalable='no' initial-scale=0.86, maximum-scale=3.0, minimum-scale=0.86">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<h1>Hello</h1>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit.
Consequatur cupiditate sed earum accusamus quidem fugiat
officia asperiores provident omnis, quod inventore vero eos quas
quibusdam, totam nulla, culpa adipisci beatae?
</p>
</body>
</html>
`)
})
app.listen(port);
console.log("it's working on "+ port);