Skip to content

Instantly share code, notes, and snippets.

View apotox's full-sized avatar
📚
reading

Safi eddine apotox

📚
reading
  • Senior Software Engineer
  • berlin
  • 15:47 (UTC +01:00)
View GitHub Profile
var path = require('path');
module.exports = {
entry: path.resolve(__dirname, 'src') + '/app/index.js',
output: {
path: path.resolve(__dirname, 'dist') + '/app',
filename: 'bundle.js',
publicPath: '/app/'
},
0x14e0e2b13814526797b6F10676d69498bCD9b411
[build]
command = "yarn build"
publish = "dist/client"
functions = "dist/server"
@apotox
apotox / webpack.client.js
Created May 24, 2019 15:31
webpack configuration to build client side javascript files for Netlify project
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")
@apotox
apotox / package.json
Created May 24, 2019 15:40
firebase-sdk-with-netlify-functions package json
{
"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": {
@apotox
apotox / package.json
Created May 24, 2019 15:42
firebase-sdk-with-netlify-functions build
"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"
@apotox
apotox / webpack.config.js
Last active May 24, 2019 15:47
webpack.config.js firebase-sdk-with-netlify-functions
//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'
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
@apotox
apotox / hello.js
Created May 24, 2019 15:55
lambda function for Netlify serverless
import * as admin from 'firebase-admin';
//global.self = {fetch: require('node-fetch')}
var serviceAccount = {
//.....
}
const app = admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
@apotox
apotox / minimal-server.go
Created June 24, 2019 09:39 — forked from peterhellberg/minimal-server.go
A pretty minimal HTTP server example in Go
package main
import (
"io/ioutil"
"log"
"net/http"
"os"
"time"
)