Skip to content

Commit b588e34

Browse files
committed
Commit changes to multiple files:
- webserver.js has been updated and has further core functionality. - added eslint testing, yarn lockfile, package.json - added CODE_OF_CONDUCT.md, updated README.md
1 parent 3232727 commit b588e34

File tree

7 files changed

+936
-385
lines changed

7 files changed

+936
-385
lines changed

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,29 @@
11
# javascript
2-
A collection of JavaScript boiler plate templates, some basic configurations and hello-world projects as a portfolio.
2+
A collection of JavaScript boilerplate templates, some basic configurations and hello-world projects as a portfolio.
3+
4+
### Project Maintenance Support:
5+
6+
Product subscriptions provided for free under the JetBrains OSS Program, which includes but is not limited to WebStorm.
7+
8+
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/WebStorm_icon.png" width="100" height="100" alt="webstorm icon">
9+
<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_square.png" width="100" height="100" alt="jetbrains logo">
10+
11+
12+
13+
<p xmlns:dct="http://purl.org/dc/terms/" xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#">
14+
<a rel="license"
15+
href="https://creativecommons.org/publicdomain/zero/1.0/">
16+
<img src="https://licensebuttons.net/p/zero/1.0/80x15.png" style="border-style: none;" alt="CC0" />
17+
</a>
18+
<br />
19+
To the extent possible under law,
20+
<a rel="dct:publisher"
21+
href="https://www.github.com/Defirence/javascript">
22+
<span property="dct:title">Defirence</span></a>
23+
has waived all copyright and related or neighboring rights to
24+
<span property="dct:title">javascript</span>.
25+
This work is published from:
26+
<span property="vcard:Country" datatype="dct:ISO3166"
27+
content="ZA" about="https://www.github.com/Defirence/javascript">
28+
South Africa</span>.
29+
</p>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"commonjs": true,
5+
"es2021": true,
6+
"node": true
7+
},
8+
"extends": "google",
9+
"overrides": [
10+
],
11+
"parserOptions": {
12+
"ecmaVersion": "latest"
13+
},
14+
"rules": {
15+
}
16+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
on:
2+
push:
3+
branches:
4+
- 'main'
5+
- 'dev'
6+
7+
name: eslint
8+
9+
jobs:
10+
pylint:
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- name: clone-branch
14+
run: |
15+
git clone -b dev https://github.com/Defirence/javascript.git
16+
printf "List files and cd into repo dir on runner..."
17+
cd boiler-plate/node-express-server
18+
ls -lah
19+
echo $PWD
20+
- name: eslint
21+
run: |
22+
printf "Running eslint against webserver.js..."
23+
cd boiler-plate/node-express-server
24+
sudo apt-get update -y && sudo apt-get upgrade -y && sudo apt-get install curl -y
25+
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
26+
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
27+
sudo apt-get install yarn -y
28+
yarn --version
29+
yarn install
30+
npx eslint webserver.js
31+
printf "Done running pylint checks, exiting ..."
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the overall
26+
community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or advances of
31+
any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email address,
35+
without their explicit permission
36+
37+
Examples of unacceptable behavior include:
38+
39+
* The use of sexualized language or imagery, and sexual attention or
40+
advances of any kind
41+
* Trolling, insulting or derogatory comments, and personal or political attacks
42+
* Public or private harassment
43+
* Publishing others' private information, such as a physical or email
44+
address, without their explicit permission
45+
* Other conduct which could reasonably be considered inappropriate in a
46+
professional setting
47+
48+
## Enforcement Responsibilities
49+
50+
Community leaders are responsible for clarifying and enforcing our standards of
51+
acceptable behavior and will take appropriate and fair corrective action in
52+
response to any behavior that they deem inappropriate, threatening, offensive,
53+
or harmful.
54+
55+
Community leaders have the right and responsibility to remove, edit, or reject
56+
comments, commits, code, wiki edits, issues, and other contributions that are
57+
not aligned to this Code of Conduct, and will communicate reasons for moderation
58+
decisions when appropriate.
59+
60+
## Scope
61+
62+
This Code of Conduct applies within all community spaces, and also applies when
63+
an individual is officially representing the community in public spaces.
64+
Examples of representing our community include using an official e-mail address,
65+
posting via an official social media account, or acting as an appointed
66+
representative at an online or offline event.
67+
68+
## Enforcement
69+
70+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
71+
reported to the community leaders responsible for enforcement at
72+
73+
All complaints will be reviewed and investigated promptly and fairly.
74+
75+
All community leaders are obligated to respect the privacy and security of the
76+
reporter of any incident.
77+
78+
## Enforcement Guidelines
79+
80+
Community leaders will follow these Community Impact Guidelines in determining
81+
the consequences for any action they deem in violation of this Code of Conduct:
82+
83+
### 1. Correction
84+
85+
**Community Impact**: Use of inappropriate language or other behavior deemed
86+
unprofessional or unwelcome in the community.
87+
88+
**Consequence**: A private, written warning from community leaders, providing
89+
clarity around the nature of the violation and an explanation of why the
90+
behavior was inappropriate. A public apology may be requested.
91+
92+
### 2. Warning
93+
94+
**Community Impact**: A violation through a single incident or series
95+
of actions.
96+
97+
**Consequence**: A warning with consequences for continued behavior. No
98+
interaction with the people involved, including unsolicited interaction with
99+
those enforcing the Code of Conduct, for a specified period of time. This
100+
includes avoiding interactions in community spaces as well as external channels
101+
like social media. Violating these terms may lead to a temporary or
102+
permanent ban.
103+
104+
### 3. Temporary Ban
105+
106+
**Community Impact**: A serious violation of community standards, including
107+
sustained inappropriate behavior.
108+
109+
**Consequence**: A temporary ban from any sort of interaction or public
110+
communication with the community for a specified period of time. No public or
111+
private interaction with the people involved, including unsolicited interaction
112+
with those enforcing the Code of Conduct, is allowed during this period.
113+
Violating these terms may lead to a permanent ban.
114+
115+
### 4. Permanent Ban
116+
117+
**Community Impact**: Demonstrating a pattern of violation of community
118+
standards, including sustained inappropriate behavior, harassment of an
119+
individual, or aggression toward or disparagement of classes of individuals.
120+
121+
**Consequence**: A permanent ban from any sort of public interaction within
122+
the community.
123+
124+
## Attribution
125+
126+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
127+
version 2.1, available at
128+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
129+
130+
Community Impact Guidelines were inspired by
131+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
132+
133+
For answers to common questions about this code of conduct, see the FAQ at
134+
[https://www.contributor-covenant.org/faq][FAQ].
135+
Translations are available at
136+
[https://www.contributor-covenant.org/translations][translations].
137+
138+
[homepage]: https://www.contributor-covenant.org
139+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
140+
[Mozilla CoC]: https://github.com/mozilla/diversity
141+
[FAQ]: https://www.contributor-covenant.org/faq
142+
[translations]: https://www.contributor-covenant.org/translations
Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
{
2+
"name": "node-express-server",
3+
"version": "0.0.1",
4+
"description": "A simple node.js express server with some simple logging features.",
5+
"main": "webserver.js",
6+
"repository": "https://github.com/Defirence/javascript/tree/main/boiler-plate/node-express-server",
7+
"author": "Defirence",
8+
"license": "CC0-Universal",
29
"dependencies": {
3-
"express": "^4.18.1",
4-
"user-agents": "^1.0.1116"
10+
"eslint": ">=5.16.0"
11+
},
12+
"devDependencies": {
13+
"eslint-config-google": "^0.14.0"
514
}
615
}
Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,43 @@
1-
//vars + const
21
const express = require('express');
3-
let app = express();
4-
const port = 3000
2+
const app = express();
3+
const port = 3000;
4+
// user-agents DOES NOT READ the actual userAgent string.
5+
// it just generates random fucking userAgent strings.
56
let userAgent = require('user-agents');
7+
const dir = '/user';
68

7-
//core
89
app.get('/', (req, res) => {
9-
res.send('Hello Express!')
10+
res.send('Hello Express!');
11+
console.log(`Received GET request to the API with userAgent:`);
12+
console.log(userAgent.toString());
13+
});
14+
15+
app.post('/', (req, res) => {
16+
res.send('Received a POST request to the API...');
17+
console.log(`Received POST request from port: ${port} to ${dir}userAgent:`)
18+
console.log(userAgent.toString());
19+
})
20+
21+
app.put('/user', (req, res) => {
22+
res.send('Received a PUT request to the API...')
23+
console.log(`Received PUT request from port: ${port} to ${dir}userAgent:`)
24+
console.log(userAgent.toString());
25+
})
26+
27+
app.delete('/user', (req, res) => {
28+
res.send('Received a DELETE request to the API...')
29+
console.log(`Received DELETE request from port: ${port} to ${dir}userAgent:`)
30+
console.log(userAgent.toString());
1031
})
1132

12-
app.listen(port,() => {
13-
console.log(`Listening on port ${port}`)
33+
app.listen(port, () => {
34+
console.log(`Listening on port ${port}`)
1435
})
1536

1637
app.use(() => {
17-
console.log(userAgent)
38+
console.log(userAgent)
1839
})
1940

2041
//userAgentLogging
2142
userAgent = new userAgent();
22-
console.log(userAgent.toString());
43+
console.log(userAgent.toString());

0 commit comments

Comments
 (0)