Skip to content

Instantly share code, notes, and snippets.

@ELLIOTTCABLE
Last active November 1, 2015 07:56
Show Gist options
  • Save ELLIOTTCABLE/3e86a990d3f79e00f3ef to your computer and use it in GitHub Desktop.
Save ELLIOTTCABLE/3e86a990d3f79e00f3ef to your computer and use it in GitHub Desktop.
Simplest possible test for web-server and redis functionality.
{
"name": "vagrant_test",
"version": "0.0.1",
"main": "index.coffee",
"scripts": {
"start": "coffee server.coffee"
},
"engines" : { "node" : ">=5.0.0" },
"dependencies": {
"coffee-script": "^1.10.0",
"hapi": "^11.0.3",
"ioredis": "^1.10.0"
}
}
# By default, `ioredis` connects to localhost, and the default Redis port, 6379
redis = new (require 'ioredis')
hapi = new (require('hapi').Server)
hapi.connection
host: 'localhost'
port: 1337
hapi.route
path:'/ping', method: 'GET'
handler: (req, resp)->
redis.ping()
.then (pong)->
resp pong
hapi.start ->
console.log 'Server running at: ', hapi.info.uri + '/ping'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment