-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be13495
commit c46363d
Showing
11 changed files
with
105 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,3 +29,4 @@ vendor/ | |
!vendor/vendor.json | ||
coverage.out | ||
docker-compose.yml | ||
examples/volume/data/ |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM nginx | ||
COPY nginx.conf /etc/nginx/nginx.conf | ||
COPY www /usr/share/nginx/html | ||
RUN chown nginx.nginx /usr/share/nginx/html/ -R |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
user nginx; | ||
worker_processes 1; | ||
|
||
error_log /var/log/nginx/error.log warn; | ||
pid /var/run/nginx.pid; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
keepalive_timeout 65; | ||
|
||
server { | ||
listen 80 default_server; | ||
listen [::]:80 default_server; | ||
|
||
root /usr/share/nginx/html; | ||
|
||
index index.html index.htm index.nginx-debian.html; | ||
|
||
server_name _; | ||
|
||
location /rest/ { | ||
proxy_pass http://app:8080/; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
} | ||
|
||
|
||
location / { | ||
try_files $uri $uri/ /index.html; | ||
} | ||
|
||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<html> | ||
<head> | ||
<title>Basic example</title> | ||
<style> | ||
button { | ||
margin-top: 10px; | ||
font-size: 25px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1>/data/</h1> | ||
<div id="data"> | ||
</div> | ||
<div> | ||
<button id="addData">add data</button> | ||
</div> | ||
|
||
</body> | ||
<script> | ||
function fetchData() { | ||
fetch('/rest/data/') | ||
.then(function(response) { | ||
return response.json(); | ||
}) | ||
.then(function(json) { | ||
var content = json.map((item) => { | ||
return `id: ${item._id}, data: ${item.data}`; | ||
}).join("<br/>"); | ||
document.querySelector('#data').innerHTML = content; | ||
}) | ||
.catch(function(err) { | ||
window.alert(err); | ||
}); | ||
} | ||
fetchData(); | ||
document.querySelector('#addData').addEventListener('click', function() { | ||
fetch('/rest/data/', { | ||
method: 'POST', | ||
headers: { | ||
'Accept': 'application/json, text/plain, */*', | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify({ | ||
data: 'some new data' | ||
}) | ||
}).then(function() { | ||
fetchData(); | ||
}) | ||
.catch(function(err) { | ||
window.alert(err); | ||
}); | ||
}); | ||
</script> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
build: ./examples/volume/templates/app | ||
build: ./app | ||
links: | ||
- db | ||
ports: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
build: ./examples/basic/templates/frontend | ||
build: ./frontend | ||
links: | ||
- app | ||
ports: | ||
|