I hereby claim:
- I am apotox on github.
- I am saphx (https://keybase.io/saphx) on keybase.
- I have a public key ASCSTpZmiKKFB9Wbi7xJM3DUHxLCUCOOwFatgApeuEck4Ao
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| JavaScript █████████████████░░░ ___ | |
| HTML ███████████░░░░░░░░░ |[_]| | |
| CSS ██████████░░░░░░░░░░ |+ ;| | |
| React █████████████████░░░ `---' | |
| Golang ██████████████░░░░░░ | |
| Muscle ███████████░░░░░░░░░ |
| package main | |
| import ( | |
| "io/ioutil" | |
| "log" | |
| "net/http" | |
| "os" | |
| "time" | |
| ) |
| import * as admin from 'firebase-admin'; | |
| //global.self = {fetch: require('node-fetch')} | |
| var serviceAccount = { | |
| //..... | |
| } | |
| const app = admin.initializeApp({ | |
| credential: admin.credential.cert(serviceAccount), |
| exports.handler = function(event, context, callback) { | |
| // your server-side functionality | |
| callback(null,{ | |
| statusCode: 200, | |
| body: `hi , my name is Safi @saphidev` | |
| }) | |
| } | |
| //or async function | |
| exports.handler = async function(event, context) { | |
| // your server-side functionality |
| //webpack.config.js | |
| require('dotenv').config() | |
| const path = require('path'); | |
| const pkg = require('./package') | |
| const GenerateJsonPlugin = require('generate-json-webpack-plugin') | |
| const externals = [ | |
| 'firebase-admin', | |
| 'lodash' |
| "start": "concurrently 'yarn start:client' 'yarn start:server'", | |
| "start:client": "webpack-dev-server --mode development --hot --config webpack.client.js", | |
| "start:server": "netlify-lambda serve src/lambda -c webpack.server.js", | |
| "build": "yarn build:client && yarn build:server && cd dist/server/ && yarn install", | |
| "build:client": "webpack --mode production --config webpack.client.js", | |
| "build:server": "netlify-lambda build src/lambda -c webpack.server.js" |
| { | |
| "name": "firebase-sdk-with-netlify-functions", | |
| "version": "1.0.0", | |
| "description": "use Firebase Admin with Netlify lambda functions… free", | |
| "private": true, | |
| "main": "index.cjs.js", | |
| "module": "index.js", | |
| "homepage": "https://github.com/apotox/firebase-sdk-with-netlify-functions", | |
| "scripts": { | |
| const path = require("path"); | |
| const HtmlWebpackPlugin = require("html-webpack-plugin"); | |
| module.exports = { | |
| entry: { | |
| main: "./src/index.js" | |
| }, | |
| output: { | |
| filename: "main.js", | |
| path: path.resolve("dist/client") |
| [build] | |
| command = "yarn build" | |
| publish = "dist/client" | |
| functions = "dist/server" |