The popular open-source contract for web professionals by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: March 15th 2016
- Original post
## RESTHeart Configuration File. | |
--- | |
#### Listeners | |
# Listeners allow to specify the protocol, ip, port and to use. | |
# The supported protocols are: http, https and ajp. You can setup a listener per protocol (up to 3). | |
# WARNING: RESTHeart uses basic authentication; usernames and passwords are sent over the net on each request. | |
# Using the http listener is not secure: users credentials can be sniffed by a man-in-the-middle attack. | |
# Use the http listener only on trusted environments. |
// LINE 160 of seneca-transport/lib/tcp.js | |
reconnect.on('disconnect', function (err) { | |
seneca.log.debug('client', type, 'disconnect', spec, topic, clientOptions, | |
(err && err.stack) || err) | |
_.find(connections, { clientOptions: clientOptions }).setup = false // This code fails. Wrapping an "undefined" guard around _.find fixes the issue. | |
}) |
seneca.ready(function() { | |
client = seneca.client({type: 'tcp'}); | |
}) |
Empty file |
This flow will download the latest Astronomy Picture of the Day (APOD) from Nasa.gov and caches in memory.
It hits the API once every 24 hours, so you don't have to worry about reaching your quota.
This flow demonstrates a technique in caching data that can be used for other sites as well - for example, you can create your own "xxx of the day" from any site that offers a random API by simply calling that random API once every 24 hours (you can change this interval) and caching the result. Calls to the API will read from the cached version.
NOTE: to use this flow you must obtain a free API key from data.nasa.gov.
I just worked out another flow to have Zero downtime (mainly for web apps). | |
Proxy | |
We use jwilder/nginx-proxy to handle routing to app servers, this will assist us in dynamically routing requests to services. | |
First Deploy | |
For the first deploy run docker-compose --project-name=app-0001 up -d. |
docker rmi $( docker images -q -f dangling=true) |
var webView = view.getViewById(page, "webView"); | |
if (webView.android) { | |
try { | |
var MyWebViewClient = android.webkit.WebViewClient.extend({ | |
shouldOverrideUrlLoading: function(_webView,interceptedUrl){ | |
console.log('Intercepted Url was ', interceptedUrl); | |
utils.openUrl(interceptedUrl); | |
return true; | |
}, | |
onPageFinished: function(_webView, pageUrl) { |
Delete all containers
$ docker ps -q -a | xargs docker rm
-q prints only the container IDs -a prints all containers
Notice that it uses xargs to issue a remove container command for each container ID