Skip to content
Snippets Groups Projects
Commit 89988454 authored by Marius Nygard's avatar Marius Nygard
Browse files

asd

parent 5c5f002a
No related branches found
No related tags found
No related merge requests found
Pipeline #22510 failed
...@@ -29,4 +29,13 @@ module.exports = class PersonDao extends Dao { ...@@ -29,4 +29,13 @@ module.exports = class PersonDao extends Dao {
callback callback
); );
} }
slettpers(id,callback){
var val = [id.id]
super.query(
"delete from person where id=?",
val,
callback
);
}
}; };
...@@ -81,9 +81,24 @@ test("oppdate en pers", done=>{ ...@@ -81,9 +81,24 @@ test("oppdate en pers", done=>{
console.log( console.log(
"Test callback: status=" + status + ", data.valu=" + data+ " asddsasd asdsdasd" "Test callback: status=" + status + ", data.valu=" + data+ " asddsasd asdsdasd"
); );
expect(data).toBeTruthy; expect(data.affectedRows).toBe(1);
done(); done();
} }
personDao.changeName({navn:"forandra",id:0},callback); personDao.changeName({navn:"forandra",id:0},callback);
}) })
test("slett en pers", done=>{
function callback(status, data) {
console.log(
"Test callback: status=" + status + ", data.valu=" + data+ " asddsasd asdsdasd"
);
console.log(data)
expect(data).toBeTruthy;
done();
}
personDao.slettPers({id:0},callback);
})
\ No newline at end of file
...@@ -41,4 +41,13 @@ app.post("/person", (req, res) => { ...@@ -41,4 +41,13 @@ app.post("/person", (req, res) => {
}); });
}); });
app.post("/editPerson", (req, res) => {
console.log("Fikk POST-request fra klienten");
console.log(req.navn+req.id)
personDao.changeName(req.body, (status, data) => {
res.status(status);
res.json(data);
});
});
var server = app.listen(8080); var server = app.listen(8080);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment