Skip to content

🔒 A functional example Hapi.js app using hapi-auth-jwt2 & Redis (hosted on Heroku) with tests!

Notifications You must be signed in to change notification settings

dwyl/hapi-auth-jwt2-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hapi-auth-jwt2 example

A functional example Hapi.js app demonstrating hapi-auth-jwt2 authentication using Redis with tests!

Build Status Test Coverage Code Climate Dependency Status devDependency Status Hapi Auth JWT2 Version HAPI 16.5.0

Run it Yourself!

Clone this repo so you can play with it locally:

https://github.com/dwyl/hapi-auth-jwt2-example.git && cd hapi-auth-jwt2-example

Install the NPM dependencies:

npm install

Environment Variables

To run this you will need to set an environment variable for your JWT_SECRET and (Server TCP) PORT.
You can then either use a local Redis Server or a RedisCloud instance (your choice, both work!).
for RedisCloud you will need to set a REDISCLOUD_URL environment variable.

export JWT_SECRET=ItsNoSecretBecauseYouToldEverybody
export PORT=8000
# OPTIONAL if you are using RedisCloud:
export REDISCLOUD_URL=redis://rediscloud:PASSWORD@pub-redis-15721.eu-west-1-2.1.ec2.garantiadata.com:15721

Note: If you (or anyone on your team) are new to Environment Variables or you need a refresher,
see: https://github.com/dwyl/learn-environment-variables

Test everything is working on your local machine

Run the tests by executing the following command in your terminal:

npm test

You should expect to see the following when the tests conclude:

tests pass

If you are seeing any errors, please get on the chat and let us know (we are here to help!)

Run the app

npm start

Note: you will need to set up your own Redis to use the code in this example in your project. if you're new to Redis check out our quick start guide: https://github.com/docdis/learn-redis

If you have any questions, please ask! Join the chat at https://gitter.im/dwyl/chat we are here to help!

If you find this guide/example useful please ⭐ the GitHub repository (so we know what we need to make more of...)

About

🔒 A functional example Hapi.js app using hapi-auth-jwt2 & Redis (hosted on Heroku) with tests!

Resources

Stars

Watchers

Forks

Packages

No packages published