-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from philtrep/memcached
Added memcached
- Loading branch information
Showing
6 changed files
with
65 additions
and
0 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
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,22 @@ | ||
## Memcached Service | ||
|
||
### Setup | ||
|
||
Copy the index file in this folder to the project root: | ||
|
||
```bash | ||
cd <project_folder>/ | ||
|
||
cp nodock/_examples/memcached/index.js . | ||
cp nodock/_examples/memcached/package.json . | ||
``` | ||
|
||
### Usage | ||
|
||
```bash | ||
cd nodock/ | ||
|
||
docker-compose up -d memcached node nginx | ||
``` | ||
|
||
By going to `127.0.0.1` in your browser you should be seeing a message indicating that `node` has successfully connected to `memcached`. |
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,16 @@ | ||
var express = require('express'); | ||
var app = express(); | ||
var Memcached = require('memcached'); | ||
|
||
app.get('/', function(req, res) { | ||
var memcached = new Memcached("memcached:11211"); | ||
memcached.connect('memcached:11211', function( err, conn ){ | ||
if( err ) { | ||
res.send('Could not connect to memcached'); | ||
} else { | ||
res.send('Connected to memcached'); | ||
} | ||
}); | ||
}); | ||
|
||
app.listen(8000); |
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,15 @@ | ||
{ | ||
"name": "example-memcached-node-docker", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "MIT", | ||
"dependencies": { | ||
"express": "^4.14.0", | ||
"memcached": "^2.2.2" | ||
} | ||
} |
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,3 @@ | ||
FROM memcached:1.4 | ||
|
||
CMD memcached |