Mike Cronin
1 min readNov 11, 2019

--

It’s a particular pattern that I learned while at bootcamp and really liked. Maybe you know it as a service? The idea is that all db interactions (e.g. anything with fetch) runs through a seperate adapter, so we better isolate our layers and dry out our code. So if two different pieces of code both need to get a user with an Id of one, they call the same function. If the url or fetching logic changes, I just have to update the adapter and all other parts still work the same. It’s sort of like how on the backend, your route handlers never touch the db, they interact with models, which are the ones who actually make the queries to the db. How do you interact with fetches? I’m sure there are lots of ways!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Responses (1)

Write a response