This commit is contained in:
Philippe Torrel
2026-10-12 08:29:27 +02:00
parent b8fe2dfafe
commit ff82f5a054
5 changed files with 121 additions and 24 deletions
+51 -16
View File
@@ -430,41 +430,76 @@ Projekte
--- ---
#### TBA ## BROWSER API
**Inhalt:**
- **Exkurs: Gulp vs Vite**
- CRUD - Create - Read - Update - Delete
- Object Methoden.
- Verwendung von Modulen (Bootstrap)
**Übungen:**
Projekte & optionale Übungen
--- ---
#### Tag 29 #### Tag 26
**Inhalt:** **Inhalt:**
- **Exkurs: DOM Inhalte über mit REST API Express** - **Exkurs: DOM Inhalte über mit REST API Express**
- **Erweiterung Frontend um REST API** - **Erweiterung Frontend um REST API**
- CRUD - Create - Read - Update - Delete - CRUD - (Create - Read) - Update - Delete
- BREAD - Browse - Read - Edit - Add - Delete - BREAD - Browse - Read - Edit - Add - Delete
- Verwendung von Modulen (Modal von BS, Toastify, Splide) - Verwendung von Modulen (Modal von BS, Toastify, Splide)
**Übungen** **Übungen**
Projekte + weiteres Modul einbinden Projekte & optionale Übungen
--- ---
#### Tag 30 #### Tag 27
- **Exkurs: Vite vs Gulp**
- **SASS 7 on 1 mit Bootstrap 6**
- **Projektfinalisierung Express + REST API** - **Projektfinalisierung Express + REST API**
- Einführung in Typescript - Einführung in Typescript
--- ---
### Tag 28
**Inhalt:**
- Typescript Grundlagen
- Typescript Annotationen
- Typescript "more Types"
**Übungen:**
Übungen 1 - 5
---
### Tag 29
**Inhalt:**
- Typescript Annotationen
- Primitive Types, Object, Union Types
- type statement vs interface
- Type Assertion with as and <>
- Typescript "more Types"
**Übungen:**
Übungen 4 - 9
---
### Tag 30
**Inhalt:**
- Typescript "more Types"
- Interface, as statement, literale
- Typescript Narrowing with Guards
- truthiness, equality, in-operator, type-predicate
- TS Funktionen und Objekte
**Übungen:**
Übungen 10 - 19
@@ -0,0 +1,25 @@
# BROWSE Products
GET http://127.0.0.1:8000/api/products
###
# READ Product
GET http://127.0.0.1:8000/api/products/174a2a19-26eb-475e-af47-4f46d2ab62ec
###
# ADD Product
POST http://127.0.0.1:8000/api/products
Content-Type: application/json
{
"name": "Testproduct",
"price": 9.99
}
###
@@ -29,10 +29,24 @@ const ProductModel = () => {
return product; return product;
}; };
const add = (product) => {
const { name, price } = product;
products.push({
_id: id(),
position: products.length + 1,
name,
price: Number(Number(price).toFixed(2)),
});
return true;
};
return { return {
load, load,
getAll, getAll,
get, get,
add,
}; };
}; };
@@ -14,7 +14,8 @@ products.load();
const app = express(); const app = express();
// Middleware ======= // Middleware =======
// app.use(express.static('./public')); app.use(express.static('./public'));
app.use(express.json()); // => HTTP-Request Body wird als JSON Objekt erwartet und geparsed. // app.use(bodyParser.json()) - Module: body-parser war in express 4 notwendig.
// Routes =========== // Routes ===========
@@ -25,18 +26,40 @@ const app = express();
// PUT/PATCH - Daten aktualisieren /Datensatz aktualisieren // PUT/PATCH - Daten aktualisieren /Datensatz aktualisieren
// DELETE - Daten löschen // DELETE - Daten löschen
// HTTP - Methode - POST
// (C)RUD - create
// BRE(A)D - add
app.post('/api/products', (req, res) => {
const product = req.body;
if (!products.add(product)) {
return res.status(400).send({ msg: 'Could not add product', status: 400, success: false });
}
return res.send({ msg: 'Product added', status: 200, success: true, data: product });
});
// HTTP - Methode - GET // HTTP - Methode - GET
// C(R)UD - read // C(R)UD - read
// (B)READ - browse // (B)READ - browse
app.get('/api/products', (req, res) => { app.get('/api/products', (req, res) => {
const data = products.getAll(); const data = products.getAll();
res.send(data); return res.send(data);
});
// HTTP - Methode - GET
// C(R)UD - read
// B(R)EAD - read
app.get('/api/products/:id', (req, res) => {
const { id } = req.params;
const data = products.get(id);
return res.send(data);
}); });
// //
app.get('/', (req, res) => { app.get('/', (req, res) => {
res.send('Server is running!'); return res.send('Server is running!');
}); });
app.get('/persons', (req, res) => { app.get('/persons', (req, res) => {
@@ -49,7 +72,7 @@ app.get('/persons', (req, res) => {
// ]), // ]),
// ); // );
res.send([ return res.send([
{ firstName: 'Max', lastName: 'Mustermann' }, { firstName: 'Max', lastName: 'Mustermann' },
{ firstName: 'John', lastName: 'Wick' }, { firstName: 'John', lastName: 'Wick' },
]); ]);
+4 -4
View File
@@ -1,6 +1,6 @@
# Meeting Fr. 09.10.2026 # Meeting Fr. 09.10.2026
- [ ] Benjamin 14:30 - 14:40 - [x] Benjamin 14:35 - 14:45
- [ ] Florian 14:40 - 14:50 - [x] Florian 14:45 - 14:55
- [ ] Christian 14:50 - 15:00 - [x] Christian 14:55 - 15:05
- [ ] Stefan 15:00 - 15:10 - [x] Stefan 15:05 - 15:15