Home
Support Forums

Deploy TS GraphQL API on Netlify Functions?

I’m making a GraphQL API with Prisma + Apollo Server from this starter: prisma-examples/typescript/graphql at latest · prisma/prisma-examples · GitHub (exact same setup as the starter)

It’s in Typescript and builds to dist directory. The server is on dist/server.

I ran netlify init but it does not automatically detect/generate netlify.toml. Frankly I’m not sure how to configure it. Is there any example of similar projects deployed on Netlify Functions that I can use as reference?

I checked the docs but this guide is marked as outdated: Deploying to Netlify | Prisma Docs

Thanks!

Hi @ekafyi

This dist directory is that you will publish. Note that you cannot run a server on Netlify (the documentation you linked to mentions running the backend on Heroku or other such service.)

Documentation for netlify.toml available here. In its simplest form you might only specify a build command and publish directory

# e.g
[build]
  command = "npm run build"
  publish = "dist"

If you are working with functions that aren’t in netlify/functions (default location) you will need to specify this location

# e.g
[build]
  command = "npm run build"
  functions = "lambda"
  publish = "dist"