web-backend-connect
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
"": {
|
||||
"dependencies": {
|
||||
"@types/express": "^5.0.1",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^5.1.0",
|
||||
},
|
||||
},
|
||||
@@ -49,6 +50,8 @@
|
||||
|
||||
"cookie-signature": ["cookie-signature@1.2.2", "", {}, "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg=="],
|
||||
|
||||
"cors": ["cors@2.8.5", "", { "dependencies": { "object-assign": "^4", "vary": "^1" } }, "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g=="],
|
||||
|
||||
"debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="],
|
||||
|
||||
"depd": ["depd@2.0.0", "", {}, "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="],
|
||||
@@ -113,6 +116,8 @@
|
||||
|
||||
"negotiator": ["negotiator@1.0.0", "", {}, "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg=="],
|
||||
|
||||
"object-assign": ["object-assign@4.1.1", "", {}, "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="],
|
||||
|
||||
"object-inspect": ["object-inspect@1.13.4", "", {}, "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew=="],
|
||||
|
||||
"on-finished": ["on-finished@2.4.1", "", { "dependencies": { "ee-first": "1.1.1" } }, "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg=="],
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@types/express": "^5.0.1",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^5.1.0"
|
||||
},
|
||||
|
||||
"scripts": {
|
||||
"start": "bun main.ts"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user