This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functions = require('firebase-functions'); | |
const admin = require('firebase-admin'); | |
admin.initializeApp(); | |
// Express Servers | |
const {simpleServer, corsServer, cleanPathServer} = require('./server'); | |
// HTTP Cloud Functions | |
const simple = functions.https.onRequest(simpleServer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.helloWorld = (req, res) => { | |
res.send('Hello, World'); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:10-alpine | |
RUN apk add ca-certificates | |
ENV NODE_ENV=production | |
WORKDIR /urs/src/app | |
COPY package.json yarn.lock ./ | |
RUN yarn install --production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functions = require('firebase-functions'); | |
exports.englishSyntax = functions.pubsub | |
.schedule('every 10 minutes') | |
.timeZone('Australia/NSW') | |
.onRun(context => { | |
console.log('triggered every 10 minutes', context); | |
}); | |
exports.cronSyntax = functions.pubsub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { onNewUser } from "./onNewUser/function"; | |
// functions in this object will be prefixed with "users" | |
// Eg: auth-onNewUser | |
const auth = { onNewUser }; | |
export { auth }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functions = require("firebase-functions") | |
const cors = require("cors") | |
const express = require("express") | |
/* Express with CORS & automatic trailing '/' solution */ | |
const app3 = express() | |
app3.use(cors({ origin: true })) | |
app3.get("*", (request, response) => { | |
response.send( | |
"Hello from Express on Firebase with CORS! No trailing '/' required!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+- dist/ # compiled code | |
| | | |
| +- index.js # CF entrypoint, defined by pkg.json "main" field | |
| +- index.js.map # maps compiled to raw source in ../src/ | |
+- node_modules/ # ignored by firebase-tools on upload | |
+- src/ # raw source code to compile | |
| | | |
| +- index.<ext> # entrypoint to compile | |
+- <config file> # config file depending on the tool | |
+- .firebaserc # firebase project identification config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "nextonfirebase", | |
"version": "1.0.0", | |
"license": "MIT", | |
"scripts": { | |
"install": "yarn build-all", | |
"next": "yarn build-firebase && cd \"src/app\" && yarn && yarn dev", | |
"preserve": "yarn build-all", | |
"serve": "firebase serve", | |
"predeploy": "yarn build-all", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Active Days: | |
all except Saturday | |
## Active Hours: | |
12am-10pm | |
## Blocked Sites: | |
bbc.co.uk | |
cnn.com | |
collegehumor.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"hosting": { | |
"public": "src/public" | |
}, | |
"functions": { | |
"source": "src/functions" | |
} | |
} |