DEV Community

joffrey giry
joffrey giry

Posted on

web / mobile app + API

Hello everyone!
I have a problem to design the structure to my application so I would like to have your advice and feedback about your experiences.
I have an application in Symfony + twig, and I would like to develop a mobile app. To do it, I was thinking about an API, I could connect my mobile app, and use a front-end framework for the web app.
However I don't know how to construct it, will I do something like that:
site.com : web app symfony + Vuejs (for example) that requests my api
api.site.com : that return json data and establishes the connection / logging part (an other symfony ?)
mobile.site.com : for my mobile app
Would that mean to have two subdomaines and three differents "projects"?

An other solution :
Is it possible to have site.com with a /api route ? Would it be easy to set up and handle the different routes between front-end framework (all routes exclude /api ) and back-end (API, only /api routes). And the mobile app would call this route ?
Sorry for my bad English :(

Top comments (1)

Collapse
 
edezacas profile image
Edu Deza

You can setup site.com/api without problems. With symfony you can create your api folder inside Controller and add to your routes.yml adding prefix api/

If you already have your app developed with symfony + twig, I think it’s your more “easy” choice.

I don’t understand your question about mobile app. If is a mobile app you don’t need a domain, you deploy directly to app/google stores. Are you developing a pwa?