Home » Javascript » Rest API and Axios Request

Rest API and Axios Request

Posted by: admin November 1, 2017 Leave a comment


I’ve written this code:

doIt(evt) {
    axios.get('/book', {
        params: {
            id: 1
    .then(function (response) {
    .catch(function (error) {

I want to get the book with id = 1

I’m using a server running in nginx.
I don’t know how to receive this request in the server and how to send the response to my client.
Help me please.


When you have a JavaScript front end that consumes a REST API back end, you have programming logic at both ends.
On its own, nginx is typically used for server static files or reverse proxying – it doesn’t have its own way of serving a REST API.

You would typically use a web framework with a database to do the back end logic of serving the API. One example of this is Django with Django REST framework.

Here is an example of how you might set up such a back end stack. Many other web frameworks are available that can be set up with nginx and do a similar job.