nano-bigodon is a minimal implementation of the Bigodon templating engine on Express.js in under 50 lines of code. It allows you to execute Bigodon templates with a simple REST API.
- Execute Bigodon templates through HTTP requests.
- Set execution time limits for template processing.
- Log helper function for debugging templates.
To get started with nano-bigodon, clone the repository and install the dependencies:
git clone https://github.com/gabriel-pinheiro/nano-bigodon.git
cd nano-bigodon
npm install
Then, whenever you want to start the server, run:
npm start
Alternatively, you can use Docker to run nano-bigodon:
docker run -p 8080:8080 gabrielctpinheiro/nano-bigodon
To execute a Bigodon template, send a POST request to /execute
with a JSON containing the template
and context
:
curl -X POST http://localhost:8080/execute \
-H "Content-Type: application/json" \
-d '{"template": "Hello, {{name}}!", "context": {"name": "World"}}'
The server will respond with the output of the template execution:
Hello, World!
You can configure the server by setting the environment variables:
PORT
: The port that the server will listen to. Defaults to8080
.EXECUTION_LIMIT
: The maximum time (in milliseconds) that the server will allow a template to execute. Defaults to100
.
For more information on the Bigodon language, available helpers, features or how to add extra helpers, check out the Bigodon repository.
nano-bigodon is licensed under the Apache-2.0 License. See LICENSE for more information.