How to use the firebase-functions.https.onRequest function in firebase-functions

To help you get started, we’ve selected a few firebase-functions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mjackson / unpkg / modules / functions / index.js View on Github external
import { https } from 'firebase-functions';

// import serveAuth from './serveAuth';
import serveMainPage from './serveMainPage';
import serveNpmPackageFile from './serveNpmPackageFile';
import servePublicKey from './servePublicKey';
import serveStats from './serveStats';

export default {
  // serveAuth: https.onRequest(serveAuth),
  serveMainPage: https.onRequest(serveMainPage),
  serveNpmPackageFile: https.onRequest(serveNpmPackageFile),
  servePublicKey: https.onRequest(servePublicKey),
  serveStats: https.onRequest(serveStats)
};
github mjackson / unpkg / modules / functions / index.js View on Github external
import { https } from 'firebase-functions';

// import serveAuth from './serveAuth';
import serveMainPage from './serveMainPage';
import serveNpmPackageFile from './serveNpmPackageFile';
import servePublicKey from './servePublicKey';
import serveStats from './serveStats';

export default {
  // serveAuth: https.onRequest(serveAuth),
  serveMainPage: https.onRequest(serveMainPage),
  serveNpmPackageFile: https.onRequest(serveNpmPackageFile),
  servePublicKey: https.onRequest(servePublicKey),
  serveStats: https.onRequest(serveStats)
};
github mjackson / unpkg / modules / functions / index.js View on Github external
import { https } from 'firebase-functions';

// import serveAuth from './serveAuth';
import serveMainPage from './serveMainPage';
import serveNpmPackageFile from './serveNpmPackageFile';
import servePublicKey from './servePublicKey';
import serveStats from './serveStats';

export default {
  // serveAuth: https.onRequest(serveAuth),
  serveMainPage: https.onRequest(serveMainPage),
  serveNpmPackageFile: https.onRequest(serveNpmPackageFile),
  servePublicKey: https.onRequest(servePublicKey),
  serveStats: https.onRequest(serveStats)
};
github mjackson / unpkg / modules / functions / index.js View on Github external
import { https } from 'firebase-functions';

// import serveAuth from './serveAuth';
import serveMainPage from './serveMainPage';
import serveNpmPackageFile from './serveNpmPackageFile';
import servePublicKey from './servePublicKey';
import serveStats from './serveStats';

export default {
  // serveAuth: https.onRequest(serveAuth),
  serveMainPage: https.onRequest(serveMainPage),
  serveNpmPackageFile: https.onRequest(serveNpmPackageFile),
  servePublicKey: https.onRequest(servePublicKey),
  serveStats: https.onRequest(serveStats)
};
github jthegedus / firebase-functions-graphql-example / firebaseFunctions / index.js View on Github external
import { https } from "firebase-functions"
import setupGraphQLServer from "./graphql/server"

/* CF for Firebase with graphql-server-express */
const graphQLServer = setupGraphQLServer()

// https://us-central1-.cloudfunctions.net/api
export const api = https.onRequest(graphQLServer)
github WalletConnect / firebase-walletconnect-push / functions / src / index.ts View on Github external
import {https, Request, config} from 'firebase-functions';
import {initializeApp, credential} from 'firebase-admin';
import { push } from './routes/push';
import { register } from './routes/register';
import cors from 'cors';

import * as serviceAccount from "./service-account.json";

const adminConfig = JSON.parse(process.env.FIREBASE_CONFIG);
adminConfig.credential = credential.cert(serviceAccount as any);
initializeApp(adminConfig);

exports.push = https.onRequest(async (req: Request, res) => {
    cors()(req, res, () => {});  
    if (req.method.toUpperCase() === "OPTIONS") {
      return res;
    }

    let response: IResponse = {
      code: 404, 
      success: false, 
      errorMessage: 'Error: Operation not supported'
    };
  
    if (req.method.toUpperCase() === "POST") {
      switch (req.params[0]) {
        case "/": 
          response = await push(req);
          break;
github angular / components / tools / dashboard / functions / payload-github-status.ts View on Github external
import {https} from 'firebase-functions';
import {verifyToken} from './jwt/verify-token';
import {setGithubStatus} from './github/github-status';

export const payloadGithubStatus = https.onRequest(async (request, response) => {
  const authToken = request.header('auth-token');
  const commitSha = request.header('commit-sha');
  const packageName = request.header('package-name');
  const packageSize = parseFloat(request.header('package-full-size') || '');
  const packageDiff = parseFloat(request.header('package-size-diff') || '');

  if (!authToken || !verifyToken(authToken)) {
    return response.status(403).json({message: 'Auth token is not valid'});
  }

  if (!commitSha) {
    return response.status(404).json({message: 'No commit has been specified'});
  }

  if (isNaN(packageDiff)) {
    return response.status(400).json({message: 'No valid package difference has been specified.'});