Angular 5 - Receive POST requests

后端 未结 1 638
粉色の甜心
粉色の甜心 2021-01-27 05:37

Scenario: My angular page should be receiving a POST request with JSON data from SpringBoot API.

Consider this as a work example:

相关标签:
1条回答
  • 2021-01-27 06:24

    Angular is a library for providing a user interface in a browser (which is a type of HTTP client).

    To listen for an HTTP request you need an HTTP server (such as Apache HTTPD, Lighttpd, NGINX, something built with Node.js+Express, etc, etc, etc).

    is there any other way to receive POST requests from API using Angular?

    No


    should be receiving a POST request with JSON data from SpringBoot API.

    Spring is a Java framework for running a webservice.

    Typically it receives HTTP requests and makes HTTP responses.

    While you could make HTTP requests from it (i.e. when a client makes an HTTP request to a Spring API, the Spring API then makes an HTTP request to another web service and uses the data in the response to construct its own response to the original request)…

    … it sounds like you have the wrong end of the stick and really need to make an HTTP POST request from Angular to Spring and then read the HTTP response in Angular.

    i.e. Ajax.

    0 讨论(0)
提交回复
热议问题