user6519911
user6519911

Reputation:

Laravel 5.4 : API controller and methods

Suppose you have a PostController for your web part, Where you are returning your views etc, And you need an Api also, What will be the best place to put the logic for Api.

Is the PostController will have the Api methods, Or another ApiPostController will be good place ?

Upvotes: 0

Views: 431

Answers (1)

Joe
Joe

Reputation: 4738

This is an opinion based question, there is no correct answer.

Personally i place my API and web controllers into separate sub folders of the controllers folder, give them separate namespaces, and then in my route groups prefix the correct namespace.

Upvotes: 2

Related Questions