rix1 / auth-now

An exploration into serverless
1 stars 0 forks source link

Auth Now

An exploration into serverless

This is the main repo for @tomfa, @andrroy and @rix1's serverless adventure

Api Reference

Currently, the API only supports GET requests.

Developing

Built With

This project defines a series of serverless functions to be hosted by ZEIT Now.

Prerequisites

You will need to have Node and now installedd globally:

Setting up Dev

To get started, clone the repo and install dependencies:

git clone https://github.com/rix1/auth-now.git
cd auth-now/
yarn install

Building

Before building, you need to copy dev-template.env to .env

cp dev-template.env .env

API keys

You need to create API keys for the email providers you wish to support. Currently only Mailgun is supported.

Private JWT Key

You also need to generate a private JWT key to sign the JWT payload. Just create a random passphrase 1Password or OpenSSL:

openssl rand -base64 32

ZEIT Now provides an additional command with Now CLI to help you develop serverless functions locally by replicating the production environment on Now with your localhost.

now dev

This supports hot reloading.

Deploying / Publishing

To deploy serverless functions you just have to run

now

from the root directory of the project. This will upload the repository to ZEIT's servers, build the project and serve the serverless API functions at https://auth-now.rix1.now.sh/api/.

Secrets

Before deploying, you need to set secrets in your production environment:

now secrets add <secret-name> <secret-value>

See Now's docs and their troubleshooting guide for more information.

Configuration

You can configure the build and deployment settings in now.json. See ZEIT docs for API reference and more info.

Aliases

You can easily alias you deployment to different domains. See custom domains for more info.

Tests

Todo

Licensing

MIT