Skip to content

Instantly share code, notes, and snippets.

@lydemann
Created November 18, 2021 18:19
Show Gist options
  • Save lydemann/b5e45412f038fc0b044c499b07ae2fc1 to your computer and use it in GitHub Desktop.
Save lydemann/b5e45412f038fc0b044c499b07ae2fc1 to your computer and use it in GitHub Desktop.
main.ts
import { region } from 'firebase-functions';
import { gqlServer } from './app/server';
import { environment } from './environments/environment';
const dotenvJSON = require('dotenv-json');
if (environment.production) {
dotenvJSON({ path: __dirname + '/assets/env.json' });
} else {
dotenvJSON({ path: __dirname + '/assets/env.local.json' });
}
const server = gqlServer();
// Graphql api
// https://us-central1-<project-name>.cloudfunctions.net/api/
const api = region('europe-west3').https.onRequest(server);
export { api };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment