Recently I came across this theme, more precisely with the tool Hugo , which basically builds sites from themes and APIs reminding a lot of Ruby on Rails.
I tested the build of an application that uses a static JSON for content listing, eg:
products.json
[{
"id": "1",
"name": "Klingon dictionary",
"price": 34.87,
"image": "/images/dictionary.jpg",
"description": "nIvbogh tlhIngan dictionary qaStaHvIS veng SuvwI'",
"url": "http://snipcart-hugo.netlify.com"
}, {
"id": "2",
"name": "Captain Kirk Phaser",
"description": "The Original Series Phaser comprises a small, hand-held Type I Phaser, which slots into a larger Type II Phaser body with a removable pistol-grip.",
"price": 145.98,
"image": "/images/phaser.png",
"url": "http://snipcart-hugo.netlify.com"
}]
HTML
<div class="col s6">
<h2 class="header">{{ .name }}</h2>
<div class="card horizontal">
<div class="card-image">
<img src="{{ .image }}">
</div>
<div class="card-stacked">
<div class="card-content">
<p>{{ .description }}</p>
</div>
<div class="card-action">
<button
class="snipcart-add-item waves-effect waves-light btn"
data-item-id="{{ .id }}"
data-item-name="{{ .name }}"
data-item-price="{{ .price }}"
data-item-url="{{ .url }}">
<i class="material-icons right">shopping_cart</i>
Add to cart
</button>
</div>
</div>
</div>
</div>
When querying the requests, the products.json
file was not requested in client
making it clear the security in working with JSON directly in DOM
.
What is and how does this type of tool work?