Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
WiolaWysopal committed Feb 26, 2024
2 parents 6e87a34 + 80f92af commit 2963789
Show file tree
Hide file tree
Showing 505 changed files with 96,906 additions and 34 deletions.
33 changes: 10 additions & 23 deletions .github/workflows/merging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,18 @@ name: Action for merging

on:
pull_request:
branches: [ main ]
types: [closed]
branches: [main]

jobs:
test:
strategy:
matrix:
node-version: [16.x, 18.x]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}

notify-merge:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- uses: actions/checkout@v3

- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Get the name of the merged branch
id: branch-name
run: echo "::set-output name=branch::${{ github.head_ref }}"
- name: Print merge message
run: echo "Branch ${{ steps.branch-name.outputs.branch }} was merged with main branch."

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- run: npm ci
- run: npm run test
2 changes: 0 additions & 2 deletions .github/workflows/testmodulowy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Node.js CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
Expand Down
47 changes: 40 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,52 @@ const dodaj = require('./dodaj')

const server = http.createServer(function(request, response) {
if (request.method == 'POST') {
// Nie potrzebujemy przetwarzać danych wejściowych od użytkownika
const result = dodaj.add100()
response.writeHead(200, {'Content-Type': 'text/html'})
response.end('Result: ' + result)
const result = dodaj.add100();
var resultPage = `
<html>
<head>
<meta charset="UTF-8">
<title>Wynik</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container mt-5">
<h1 class="text-center">Result: ${result}</h1>
<div class="row justify-content-center">
<div class="col-md-4 text-center">
<a href="/" class="btn btn-primary">Back to main page</a>
</div>
</div>
</div>
</body>
</html>`;

response.writeHead(200, {'Content-Type': 'text/html; charset=utf-8'});
response.end(resultPage);
} else {
var html = `
<html>
<head>
<meta charset="UTF-8">
<title>Node.js Number Adder</title>
<!-- Dołączanie Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<form method="post" action="http://localhost:3000">
<input type="submit" value="Add numbers from 1 to 100" />
</form>
<div class="container mt-5">
<h1 class="text-center">Node.js Number Adder</h1>
<p class="text-center">Click the button below to add numbers from 1 to 100.</p>
<div class="row justify-content-center">
<div class="col-md-4 text-center">
<form method="post" action="http://localhost:3000">
<input type="submit" class="btn btn-primary btn-lg" value="Add numbers from 1 to 100" />
</form>
</div>
</div>
</div>
</body>
</html>`

response.writeHead(200, {'Content-Type': 'text/html'})
response.end(html)
}
Expand Down
28 changes: 28 additions & 0 deletions node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions node_modules/@popperjs/core/LICENSE.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2963789

Please sign in to comment.