Generate an api to be consumed asynchronously


#1

Hi !

Is it possible to use Hugo to generate an API (sort of) ? By that, I mean to generate a JSON file that I can consume in dynamic client applications (React for exemple).

I this case, I wouldn’t care about themes, css and stuff.

Thanks !


#2

Yes it is, take a look at the custom output formats. https://gohugo.io/templates/output-formats/


#3

I assume there is no way to generate it automatically from the content folder architecture ?


#4

How would that work? Some kind of AI?


#5

Could be parsing recursively (I have absolutely no knowledge in the Hugo way of working, therefore I don’t know what is feasible and what is not)

But regarding your response I guess the response is not :stuck_out_tongue:

Thanks anyway !


#6

Sure. And as @brunoamaral said, this is both possible and very simple. But you have to tell Hugo what you want (some configuration and template). We cannot guess.


#7

Thanks for letting us know! Please read the docs and then ask us specific questions after you know how Hugo works. :slight_smile:


#8

True. Thanks !