E
E
Egor Babintsev2020-01-17 10:01:28
RESTful API
Egor Babintsev, 2020-01-17 10:01:28

How to make a simple REST API on Laravel?

I want to make a simple application with a backend API on Laravel and a front on React, which gets all the ajax information from the API. But the question arises: when deploying this project to the server, it will be possible to make a request to the API not only from this source? If yes, then this is not what I would like. I only need it so that the frontend part uses it. The idea came to mind that we need to make a middleware that will check if a request comes from the same domain or not, is it the right idea? Thanks in advance for your response

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Wells, 2020-01-17
@Alex_Wells

What for? Who wants to get through to your API, regardless of the protections you hang. And 99.99% will not give a shit that you have a public API.
Middleweir won't help. The most you can do is to secure your site for your users using CORS, but the API will still be public and quite accessible.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question