#handlers of backend

7 messages · Page 1 of 1 (latest)

mossy ridge
#

Hi, I'm learning backend development. Is it in the handlers where the queries to the database are made?

craggy sedge
#

that's a very vague question

#

it could be simultaneously yes and no to that abstract answer

#

to answer the yes, well yes when handlers are called, it might query the database to serve the request

#

to answer the technical no, when handlers are called, it might instead call a "service" which is an interface that allows for retrieval and storing of data
it's the service which would make calls to the actual underlying database in this context

#

the "service as a middleman" allows for database agnostic code, the handler does not need to be aware of the database, the database is now abstracted as a service specific implementation detail

mossy ridge
#

great answer thanks a lot