Last active
November 1, 2015 07:56
-
-
Save ELLIOTTCABLE/3e86a990d3f79e00f3ef to your computer and use it in GitHub Desktop.
Simplest possible test for web-server and redis functionality.
This file contains hidden or 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
{ | |
"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" | |
} | |
} |
This file contains hidden or 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
# 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