web-backend-connect

This commit is contained in:
CoGomu
2025-05-24 20:27:10 +02:00
parent 5a66a6db3c
commit fd22136757
10 changed files with 118 additions and 15 deletions

View File

@@ -1,20 +1,35 @@
import express from 'express';
import express from 'express'
import cors from 'cors'
const app = express();
app.use(cors())
app.use(express.json());
app.get('/', (req, res) => {
res.send('Hello World');
});
app.get('/tasks', (req, res) => {
res.send(
{tasks: []}
["Homework", "cleaning", "learn Arrow-functions"]
);
});
app.get('/events', (req, res) => {
res.send(
{events: []}
[
{
"title": "wedding",
"from": "2025-05-19T08:30:26.195+02:00",
"to": "2025-05-19T12:32:55.883+02:00"
},
{
"title": "funeral",
"from": "2025-05-19T15:26:34.178+02:00",
"to": "2025-05-19T18:12:43.409+02:00"
}
]
);
});
@@ -72,6 +87,8 @@ app.post('/event', (req, res) => {
const newEvent = req.body;
console.log(newEvent)
//Validate
//const newEventWithId = db.createEvent(newEvent)