Skip to content

Commit 1b1cbcf

Browse files
committed
Initial commit
0 parents  commit 1b1cbcf

File tree

4 files changed

+508
-0
lines changed

4 files changed

+508
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
.DS_Store
3+
yarn-error.log

index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const express = require("express");
2+
const IORedis = require("ioredis");
3+
4+
const app = express();
5+
const port = 3000;
6+
7+
const redis = new IORedis({
8+
host: "redis.hop",
9+
port: 6379,
10+
});
11+
12+
app.get("/", async (req, res) => {
13+
const count = await redis.incr("count");
14+
res.send(`This page has been visited ${count} times!`);
15+
});
16+
17+
app.listen(port, () => {
18+
console.log(`Example app listening on port ${port}`);
19+
});

package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "node-express-redis",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"repository": "[email protected]:hop-examples/node-express-redis.git",
6+
"author": "Alistair Smith <[email protected]>",
7+
"license": "MIT",
8+
"dependencies": {
9+
"express": "^4.18.2",
10+
"ioredis": "^5.2.5"
11+
}
12+
}

0 commit comments

Comments
 (0)