It's an application generator, I will try to make this to generate the most possible parts of an application.
WARNING: This project is incomplete.
The static-site generator is inspired in an imperative language like SQL for accessing data, and a funcional language like Javascript for formating data.
The following operations are implemented:
Adding a template:
{{ PASTE /root/path/to/file }}
or
{{ PASTE relative/path/to/file }}
like
<html>
<style>
{{ PASTE css/style.css }}
</style>
</html>
Formating data:
{{ FORMAT object_type FROM path/to/schemas.yaml AS object IN
() => (`
<!-- this is Javascript returning a template using the object -->
<div>
<p>${object.field}</p>
</div>
`)
}}
or
<ul>
{{ FORMAT apples FROM schemas.yaml ORDER BY DESC taste AS apple AND
FORMAT bananas FROM schemas.yaml AS banana IN
() => (`
<li>${apple.name}</li>
<li>${banana.name}</li>
`)
}}
</ul>
Before runnning gogen is necessary to write a genesis.yaml file that will contain all the site routes associated with a path to an .html that will represent that route in the web. The genesis.yaml file defines too the API for the server.
Genesis file specification
---
name: application_name
routes:
- web: /
file: pages/home/index.html
- web: /customer/:id
file: pages/customer/index.html
schemas:
object:
field: value
...
Running gogen:
gogen genesis.yaml
Important: The route path of the application will be the genesis.yaml directory.
- On templates/handler.go don't convert to string but uses pure []byte.
- AWS.
- Azure.
- Google Cloud.