bluetoothfx
03/20/2022, 12:22 PMgaryaustin
03/20/2022, 1:52 PMbluetoothfx
03/20/2022, 3:22 PMgaryaustin
03/20/2022, 3:26 PMgaryaustin
03/20/2022, 3:26 PMbluetoothfx
03/20/2022, 3:34 PMgaryaustin
03/20/2022, 3:35 PMdebabrata
03/20/2022, 4:54 PMbluetoothfx
03/20/2022, 5:51 PMbluetoothfx
03/20/2022, 5:51 PMdebabrata
03/20/2022, 5:59 PMapi/account/
let's say to fetch account details from the db. Since functions in api routes run on the server I could use normal node.js code. There are multiple libraries which you can use to connect to your postgres db and run queries (I don't remember which one I used unfortunately)
For passing data between client and server... Let's say I want to fetch the account details for account id 123. I can make a post request at my /api/account
endpoint and pass the account id in the body of the request. I can access this from the request object the server receives. Then I can run the required query and return the data back to the client in the responsedebabrata
03/20/2022, 6:00 PMbluetoothfx
03/20/2022, 6:15 PMdebabrata
03/20/2022, 6:23 PMNeedle
03/20/2022, 10:02 PM