Refactoring Web Services

Hi everyone! I have a web service with multiple methods and I just want to ask if it is better to combine all the methods into one and put a parameter('action') to determine what controller to run.

What do you think is faster, maintainable and easy to extend?

Thank you!

Did you find this post useful? Show some love!

There is no silver bullet and it heavily depends on details.

I personally would go with several endpoints to have all the handlers clean and relatively tiny.

I would suggest to seperate them from start, it will help you in future as code base starts to grow. Try to think of SOLID Principles ( when coding.

In my opinion, it is better to separate each methods according to its usage. It would be maintainable in the long run.


Hey there, we see you aren't signed in. (Yes you, the reader. This is a fake comment.)

Please consider creating an account on It literally takes a few seconds and we'd appreciate the support so much. ❤️

Plus, no fake comments when you're signed in. 🙃

In addition Eldlabs' suggestion, don't forget 12 Factor App while writing web services.

Classic DEV Post from May 18

Go or Python and why?

So a friend of mine was considering either learning python òr go. What would be...

Follow @albertdugba to see more of their posts in your feed.
I'm a passionate web developer
More from @gentlemanoi
Refactoring If-else statement
#discuss #coding #learning
The Progressive JavaScript Framework
#javascript #beginners #webdev #programming
Trending on
So You Learned React, and Now You Work with jQuery...
#career #beginners #productivity
What are some good questions for a "State of the Web" survey?
#webdev #discuss
A beginners guide to finding a mentor
#programming #learning #selftaught #improvements
The Secret Life of Objects: Information Hiding
#programming #design #oop
Back to basics: Naming
#naming #javascript #programming #discuss
Write less code
#quote #programming #cleancode
Does anyone else feel bothered when people term us as coders instead of developers or programmers..?
5 Reasons You Should Write That Blog Post
#career #beginners