0

My web application sends data in below format

data = {User: [{id:"1",name:"Smith",email:"simth@test.com"},{id:"2",name:"Roy",email:"roy@test.com"}], Color: "Orange", Shape: "Triangle"}

We need to create an API to insert the above data received into our POSTGRES database table. The table has columns Email, Color and Shape. So based on the sample data above there will be two inserts that will happen

1. Email:simth@test.com, Color: Orange, Shape: Triangle
2. Email: roy@test.com, Color: Orange, Shape: Triangle

Please note the data received cannot be modified now. How do we handle this in Express or Postgres and do bulk insert of the records.

Joy
  • 105
  • 1
  • 2
  • 10

0 Answers0