I want to know if to make an application on android, should I connect and make queries directly to the bd, or use an API? , I have currently made a web in express / nodejs and mongo using jade and angular for the management of templates and part of the front, in which each endpoint renders a page with the respective data, I have the following endpoint, I will only put some.
GET /user/perfil/:id/eventos --Lista de eventos suscritos o creados(tuyos)
GET /user/perfil/:id/eventos/:id -'-Muestra el evento x o debería redirigir a /eventos/:id ??'
GET /user/perfil/:id --Te muestra el perfil con id tal
GET /eventos --Te muestra la lista de eventos creados(todos)
GET /eventos/:id --Vuelve a mostrar el evento x (publico para todos)
I have only put the gets, and some, with a little doubt in the 2nd 5 ° endpoint, now if I want to consume the data from android, I am seeing create an endpoint similar to the following.
GET "/api/users"
GET "/api/eventos"
GET "/api/rectififaciones"
Being that to the api, I would have to put a middleware so that it is only accessible through a token, maybe jwt ?, it's ok my logic or how else could I do it, thanks in advance.