Luis Adrian Zuluaga
Luis Adrian Zuluaga

Reputation: 1

YII2, rest API without database connection

I have been studying how to develop a rest API with YII and everything is clear from the documentation.

In the documentation they suggest using ActiveRecord however I will have inside my application some controllers that do nothing in the database, I mean they work with vectors or files or for example complex controllers that have to update several tables in the database or make queries to other APIs to later make updates.

What do you think is the best approach to fix this?

I would like to keep the same "Bearer Token" authentication for all controllers regardless of whether it is a simple one that works with ActiveRecord or a complex one that involves other actions.

Thank you in advanced.

Upvotes: 0

Views: 193

Answers (1)

DrBorrow
DrBorrow

Reputation: 958

Public function actionExample(){
// do stuff
// $result
return json_encode($result);
}

Upvotes: 0

Related Questions