Answer the question
In order to leave comments, you need to log in
Symfony, API development?
We are developing a simple api for a mini project. The project has a LC.
What is the point?
When we turn to api, we check the presence of apikey, then there is standard logic.
But it turns out that we would access the database and check users and their indicators, our api is located at
site.ru/api/actionMethod/
But, we basically need to do what would be api.site.ru/actionMethod/
Not do we make a copy of the site and expand the database from the first site there? Or make a subdomain and make direct requests to a third-party database from it? Terrible decision in my opinion.
So far, the decision comes to my mind, to set up a server. I created a subdomain that looks in the same folder as the main domain.
And it turns out that I have one site available at two addresses.
That is, the question is, how can I make api.site.ru address requests to site.ru/api/actionMethod/ and return responses?
Or maybe there is a more competent solution how to do this, Or how can I set up a server to solve my problem?
Answer the question
In order to leave comments, you need to log in
Judging by the tags, you have Apache there. What is the difficulty of setting up a redirect directly in it?
<VirtualHost *:80>
ServerName api.site.ru
Redirect site.ru/api
</VirtualHost>
I don't understand the point. You register api.site.ru in the DNS and IP to your server. There you send Apache to the same folder as site.ru - you will have the same answers both from site.ru/api/actionMethod and from api.site.ru/actionMethod
Since "a simple api for a mini project" - this is quite enough.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question