Tegnapi Frondend feladat kész
This commit is contained in:
parent
f36bb172f9
commit
ff0026e138
|
@ -1,32 +1 @@
|
|||
[
|
||||
{
|
||||
"nev": "Janics",
|
||||
"beosztas": "anyád",
|
||||
"kor": 13,
|
||||
"fizetes": "250000 Ft"
|
||||
},
|
||||
{
|
||||
"nev": "Pista",
|
||||
"beosztas": "apád",
|
||||
"kor": 21,
|
||||
"fizetes": "170000 Ft"
|
||||
},
|
||||
{
|
||||
"nev": "Juliska",
|
||||
"beosztas": "testvéred",
|
||||
"kor": 19,
|
||||
"fizetes": "140000 Ft"
|
||||
},
|
||||
{
|
||||
"nev": "Mariska",
|
||||
"beosztas": "nagymamád",
|
||||
"kor": 15,
|
||||
"fizetes": "190000 Ft"
|
||||
},
|
||||
{
|
||||
"nev": "Móricka",
|
||||
"beosztas": "nagyapád",
|
||||
"kor": 18,
|
||||
"fizetes": "210000 Ft"
|
||||
}
|
||||
]
|
||||
[{"nev":"Janics","beosztas":"anyád","kor":13,"fizetes":"250000 Ft"},{"nev":"Pista","beosztas":"apád","kor":21,"fizetes":"170000 Ft"},{"nev":"Juliska","beosztas":"testvéred","kor":19,"fizetes":"140000 Ft"},{"nev":"Mariska","beosztas":"nagymamád","kor":15,"fizetes":"190000 Ft"},{"nev":"Móricka","beosztas":"nagyapád","kor":18,"fizetes":"210000 Ft"},{"nev":"csicska","beosztas":"kaka","kor":"26","fizetes":"150000 Ft"}]
|
|
@ -15,18 +15,11 @@ app.get("/", (req, res) => {
|
|||
})
|
||||
|
||||
app.post("/feltoltes", (req, res) => {
|
||||
let adat =
|
||||
|
||||
fs.readFile("F:\\Suli\\13.b\\Frontend\\Javascript\\2024. 11. 18\\public\\json/munkavallalok.json", "utf8", (err, data) => {
|
||||
adat = data
|
||||
console.log();
|
||||
let adat = JSON.parse(data)
|
||||
adat.push(req.body)
|
||||
|
||||
})
|
||||
|
||||
console.log(adat);
|
||||
|
||||
|
||||
fs.appendFile("F:\\Suli\\13.b\\Frontend\\Javascript\\2024. 11. 18\\public\\json/munkavallalok.json", adat, (err, data) => {
|
||||
fs.writeFile("F:\\Suli\\13.b\\Frontend\\Javascript\\2024. 11. 18\\public\\json/munkavallalok.json", JSON.stringify(adat), (err, data) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
|
@ -35,6 +28,8 @@ app.post("/feltoltes", (req, res) => {
|
|||
console.log("Sikeres feltöltés!");
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
app.listen(3000)
|
||||
|
|
Loading…
Reference in New Issue
Block a user