https://github.com/amir/ngx_http_jsonnet_module
Jsonnet for nginx
https://github.com/amir/ngx_http_jsonnet_module
jsonnet nginx
Last synced: about 2 months ago
JSON representation
Jsonnet for nginx
- Host: GitHub
- URL: https://github.com/amir/ngx_http_jsonnet_module
- Owner: amir
- License: unlicense
- Created: 2017-06-11T14:55:18.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-11T15:00:16.000Z (over 8 years ago)
- Last Synced: 2025-04-23T20:11:26.438Z (6 months ago)
- Topics: jsonnet, nginx
- Language: C
- Size: 3.91 KB
- Stars: 5
- Watchers: 0
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Name
====
ngx_http_jsonnet_module - [Jsonnet](http://jsonnet.org/) for nginxSynopsis
========
```nginx
http {
...
server {
location /jsonnet {
jsonnet on;
}
}
}
```Status
======
Proof of concept.Installation
============
You'll need libjsonnet and its C API. One way to obtain it is:```bash
git clone https://github.com/google/jsonnet.git
cd jsonnet
make libjsonnet.so
```And then build nginx:
```bash
wget http://nginx.org/download/nginx-1.12.0.tar.gz
tar zxf nginx-1.12.0.tar.gz
cd nginx-1.12.0
LIBJSONNET_LIB=/path/to/jsonnet LIBJSONNET_INC=/path/to/jsonnet/include ./configure --prefix=/tmp/nginx --add-module=/path/to/ngx_http_jsonnet_module && make -j4 && make install
```Description
===========
This is an nginx module integrating [Jsonnet](http://jsonnet.org/).```
cat /tmp/jsonnet.example
{
person1: {
name: "Alice",
welcome: "Hello " + self.name + "!",
},
person2: self.person1 { name: "Bob" },
}curl -d "@/tmp/jsonnet.example" -X POST http://localhost:9000/jsonnet
{
"person1": {
"name": "Alice",
"welcome": "Hello Alice!"
},
"person2": {
"name": "Bob",
"welcome": "Hello Bob!"
}
}
```