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 Chain = require("middleware-chain-js"); | |
const bodyParser = require("body-parser"); | |
const app = new Chain(); | |
//* parses JSON content | |
app.use(bodyParser.json()); | |
app.use(function(req, res) { | |
console.log(req.body); |
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": "hellocli", | |
"version": "0.0.1", | |
"description": "Hello World in a CLI", | |
"bin": { | |
"hello-cli": "hellocli.js" | |
}, | |
"keywords": [ | |
"hello", | |
"cli" |
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
#! /usr/bin/env node | |
const argv = require('yargs').argv; | |
// Parse command | |
if (argv._.length == 1) { | |
switch (argv._[0]) { | |
case 'greet': | |
greet(argv); | |
break; |
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": "hellocli", | |
"version": "0.0.1", | |
"description": "Hello World in a CLI", | |
"bin": { | |
"hello-cli": "hellocli.js" | |
}, | |
"keywords": ["hello", "cli"], | |
"author": { | |
"name": "Blessing Pariola" |
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
#! /usr/bin/env node | |
console.log("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
{ | |
"name": "functions", | |
"description": "Cloud Function", | |
"dependencies": { | |
"firebase-admin": "^5.6.0", | |
"firebase-functions": "^0.7.5" | |
} | |
} |
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": "cfes6", | |
"version": "1.0.0", | |
"description": "Using ES6+ in Cloud Functions", | |
"main": "index.js", | |
"scripts": { | |
"prebuild": "node node_modules/rimraf/bin functions", | |
"build": "babel app --out-dir functions --copy-files --ignore app/node_modules", | |
"postbuild": "cd functions && npm i -s", | |
"deploy": "npm run build && firebase deploy" |
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 * as functions from "firebase-functions"; | |
export let helloWorld = functions.https.onRequest((req, res) => { | |
let world = `from ES6 in Cloud Functions!`; | |
res.status(200).send(`Hello ${world}`); // Template literals | |
}); |