web-backend-connect
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user