Clone

Running the server

Instructions on how to start the API2HTML server to serve an example blog site.

API2HTML needs a configuration file in json format with the definition of the service you want to start. As the configuration file declares what templates are loaded in every page, you will need to have these templates in a folder too. The easiest way to get started is using the blog example provided in the source code under examples/blog. Here you have all the files to run your first site.

Starting the server with an example site

As we said, we will use the blog example to demonstrate how API2HTML works. The code is provided in the source code. Just do:

cd examples/blog
api2html serve -d -c config.json -p 8080

This will start the server in http://localhost:8080, with a fake blog that is loading data from an external API. The flag -d enables the debug so you can see everything is happening, do not use it in production.

To stop the service just press CTRL-C.

You can use any other example instead of the blog.


Continue to Creating your first site

← Back to Installation