quick node.js express redis user management – 1

Eran Goldman-Malka · December 27, 2016

I needed a user management system and a reason to use redis, So I decided to combine them both.

this post will be about the stack installation

for the building of the user management itself go to part 2 of this guide

what do we need

linux – Debian or Ubuntu

node.js

redis

mongodb

Stack installation

We’ll start with clean Debian or Ubuntu installation.

node.js

sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

Express

sudo npm i express -g

MongoDB

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

Redis

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-redis-on-ubuntu-16-04

# from another trerminal redis-cli ping
# if he answer pong it’s great

Some nice to have helpers

sudo npm i nodemon -g

App creation

express myapp
cd myapp && npm install

Dependencies

npm i express-session --save
npm i connect-redis --save
npm i mongoskin --save
npm i mongodb --save

Run

nodemon bin/www

and now we can surf to localhost:3000 and see express hello world

in the second part we’ll write some node.js code to manage the users.

Twitter, Facebook