Skip to content

rix1/auth-now

Repository files navigation

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.

  • GET /api/email/test@info.com 👉 Send email using Mailgun as provider to test@info.com.

    Specify subject and body using query parameters. Example GET /api/mailgun/send/test@info.com?title=Hello&text=how%20is%20it%20going?

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:

  • Node >=8.x
  • npm install -g now

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

About

An exploration into serverless

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published