How to integrate Go's famework with ReactJs?

1

In a project it is already defined that we are going to use Golang for the Backend and its Siris framwork, but for the Frontend it is going to use react. I have not seen that integration before.

    
asked by Johnny Pachecp 22.02.2018 в 00:47
source

1 answer

1

I was seeing that Siris uses the HTTP methods, like GET, POST, UPDATE, DELETE, there is a very easy and very easy to use http client called Axios link the documentation is very clear I see that you are in main this method is

  // Method GET: http://localhost:8080/profile/anytypeofstring
    app.Get("/profile/{username:string}", profileByUsername)

in axios you are going to use something like that

axios.get('/profile?username=nombre')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

How you use promises will return a response from the server, or an error. I recently built an application with vuejs, axios and go works excellent. greetings

    
answered by 21.03.2018 / 16:16
source