-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
28 lines (22 loc) · 808 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const redis = require('redis');
const express = require('express');
const stringUtils = require('./utils/strings.js')
const app = express();
const client = redis.createClient();
client.on('error', function(err) {
console.log('Something went wrong ', err);
});
app.post('/setValue', function(req, res) {
client.set('String record', 'this Is What is sAved In Redis', redis.print);
})
app.get('/savedRecord', function (req, res) {
client.get('String record', function(err, result) {
const lowercaseValue = stringUtils.lowercase(result);
const fixedConcat = stringUtils.concatenate('value saved in lowercase: ', lowercaseValue)
res.send(`original value: ${result} ------
after edit: ${fixedConcat}`)
})
})
app.listen(3000, function () {
console.log('Listening on port 3000!')
})