Rizialdi / serverless-prisma

Deploying a Prisma 2 app with apollo-server on AWS Lambda using the Serverless framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Serverless Prisma

A GraphQL API created using the Serverless framework using the following tools

Prerequisites

  • node >= 10
  • yarn (recommended) or npm

Commands

  • yarn db:save: Run this command at the start of the project to generate the migrations for your Prisma model located in prisma/schema.prisma

  • yarn db:migrate: Run this command to add your migrations to the database.

  • yarn dev: Runs the server in development mode via the sls offline command and simulates the entire API on http://localhost:3000/dev/graphql by default.

    • Copy/Rename the .env.example to .env and replace the DATABASE_URL with the database URL.
  • yarn deploy: Deploy your application via sls deploy on AWS Lambda.

    • Copy/Rename the .env.example to .env.production and replace the DATABASE_URL with the database URL and set NODE_ENV to production (this is required for Nexus to not generate artifacts).

Note: AWS Access and Secret keys must be configured via aws configure using the aws-cli. The setup uses the default profile but you can pass a custom one using yarn deploy --profile profileName.

About

Deploying a Prisma 2 app with apollo-server on AWS Lambda using the Serverless framework


Languages

Language:TypeScript 59.6%Language:JavaScript 40.4%