Skip to content

Commit 0501cbe

Browse files
committed
add gitignore,update package.json, update README, update webserver code to not generate new UA strings but pull and store into logs instead, update yarn.lock
1 parent 0947276 commit 0501cbe

File tree

5 files changed

+489
-12
lines changed

5 files changed

+489
-12
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# node-express-server
22
A simple node.js webserver with basic API functionality, written in pure JavaScript.
33
Dependencies:
4-
- yarn version: 1.22.19
5-
- npm version: 8.15.0
6-
- node.js version: v16.17.0 LTS
4+
- yarn version: 1.22.22
5+
- npm version: 10.9.2
6+
- node.js version: v22.14.0
77
- ECMA version: `latest`, other information present in `.eslintrc.json`
88

99
Makes use of Snyk for IaC and Security scanning.

boiler-plate/node-express-server/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"author": "Defirence",
88
"license": "CC0-Universal",
99
"dependencies": {
10-
"eslint": ">=5.16.0"
10+
"eslint": ">=5.16.0",
11+
"express": "^5.1.0",
12+
"user-agents": "^1.1.502"
1113
},
1214
"devDependencies": {
1315
"eslint-config-google": "^0.14.0"

boiler-plate/node-express-server/webserver.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
const express = require('express');
22
const app = express();
33
const port = 3000;
4-
// user-agents DOES NOT READ the actual userAgent string.
5-
// it just generates random userAgent strings.
6-
let userAgent = require('user-agents');
4+
const UserAgents = require('user-agents');
5+
const userAgent = new UserAgents().toString();
76
const dir = '/user';
87

98
app.get('/', (req, res) => {
@@ -38,6 +37,5 @@ app.use(() => {
3837
console.log(userAgent);
3938
});
4039

41-
// userAgentLogging
42-
userAgent = new userAgent(); // eslint new-cap: "off"
43-
console.log(userAgent.toString()); // eslint new-cap: "off"
40+
// userAgentLogging - fix this to not use new userAgent(); and rather pull the existing UA string.
41+
console.log(userAgent); // Logging the existing userAgent string

0 commit comments

Comments
 (0)