Is it possible to render your data using an html template before displaying the data from DB in Eve

62 views Asked by At

I am developing a simple API using Eve, to display the data from my Database on the web client using Eve, just following the quickstart guide in Eve documents to write a schema and defining the resource in DOMAIN in settings.py, I can see the data in xml on a browser or using curl.

https://docs.python-eve.org/en/stable/quickstart.html#a-more-complex-application

The data we see, (in the peoples eg) is either json/xml, for e.g: in json output:

{
    "firstname": "barack",
    "lastname": "obama",
    "_id": "50acfba938345b0978fccad7"
    "updated": "Wed, 21 Nov 2012 16:04:56 GMT",
    "created": "Wed, 21 Nov 2012 16:04:56 GMT",
    "_links": {
        "self": {"href": "people/50acfba938345b0978fccad7", "title": "person"},
        "parent": {"href": "/", "title": "home"},
        "collection": {"href": "people", "title": "people"}
    }
}

How can I change the html formatting of this data, using a template? For instance I want to create a table and display each item as a row in the table? Is there a way we can render this data using a Jinja templates by using event hooks?

1

There are 1 answers

0
Iman Shafiei On

I think you should better use Django, because in the definition o eve:

Eve is an open source Python REST API framework designed for human beings. It allows to effortlessly build and deploy highly customizable, fully featured RESTful Web Services.

It's created for RESTful purposes.