I would like to create an API. For a URL I need the following: An ID is passed to the API. Now the database (postgres) should deliver the corresponding record. The data is recalculated and written back.
I do not get it that I can read a value and edit it. How do I have to proceed there?
Does anyone have an example?
Ive not used postgressSql but I have found this tutorial on it, i have not watched it, but it might help you:
here is an example from something Ive written but it uses php, you will adjust do something like this using node to do what you want to do:
An ID is passed…
$stmt = $db->prepare("SELECT name FROM tbl_buildings WHERE building_id=:buildingId "); $stmt->execute(array(':buildingId' => $buildingId));
In the above example the $buildingId is from the http verb in the link i used a get in this case:
$buildingId = $_GET['id'];
you would for example have the above data your looking for in the $stmt,
The data is recalculated and written back.
so for example, you would display that to the user and do some dom update, that thing in the dom that you are updating need that piece of information attached to it i.e. the ID, your going to use that to perform what you are wanting to do next, the update so you will do something like this:
UPDATE sometable SET somecolumb=’’ WHERE someId =’".howeveryouwanttosendtheID."’
Thank you very much.
The biggest problem is dealing with the await and sync.
I think that is the away?
There are many tutorials about create, edit and delete. But the topic “processing data” is difficult to find.