forked from moulik-deepsource/demo-javascript
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.js
More file actions
34 lines (24 loc) · 775 Bytes
/
server.js
File metadata and controls
34 lines (24 loc) · 775 Bytes
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
const express = require('express');
const request = require('request'); // request is deprecated. Prefer using `axios` instead
const helmet = require('helmet')
const app = express(); // Sensitive
app.use(
helmet.expectCt({
enforce: false // Sensitive. It should be true
})
)
request('http://www.google.com', function (error, response, body) {
console.error('error:', error); // Print the error if one occurred
console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
console.log('body:', body); // Print the HTML for the Google homepage.
});
app.get('/', function (req, res) {
res.send('hello')
});
/**
* @deprecated
*/
function add(a, b) {
return a + b;
}
module.exports = add;