Skip to content

An example of doing passwordless login and signup with mojo.js

Notifications You must be signed in to change notification settings

byoungdale/mojojs-passwordless-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mojojs-passwordless-example

This is an small example of doing passwordless login with mojo.js.

example-gif

Run example

You need a postgresql database and email server to run the example. See below for how to easily get those running with docker.

1. Start postgres and create database

docker run --rm   --name pg-docker -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 -v $HOME/docker/volumes/postgres:/var/lib/postgresql/data  postgres
psql -h 'localhost' -c "CREATE DATABASE mojojs_passwordless_example_dev" "user=postgres dbname=postgres password=postgres"

2. Start maildev email server

You will be able to check emails at http://localhost:1080.

docker run  -d -p 1080:1080 -p 1025:1025 maildev/maildev

3. install dependencies and build

npm install
npm run build

4. Run migration

node lib/index.js migrate

5. Start minion.js background worker for handling signup & login email jobs

node lib/index.js minion-worker --jobs 12

6. Start dev server

Leave the background worker running in a separate terminal window.

npm run dev