google-function-http-tool
TypeScript icon, indicating that this package has built-in type declarations

1.0.18 • Public • Published

google-function-http-tool

=========

A simple google function creator, it makes your google function code small with default provided setting; you just have to add what you need to add , no more unnecessary coding! Everything is configured , and also can be fine tuned with custom stuff. You can create normal express app too with this tool.

fixes in 1.0.15

fixing express header vulnerabilities.

Installation

npm install google-function-http-tool

Usage

const gFunction = require('google-function-http-tool');
const genericHandlers = gFunction.genericHandlers;
const initiateExpress = gFunction.initiateExpress
// import { genericHandlers, routes, initiateExpress } from "google-function-http-tool";

let AppUtility = new genericHandlers();
const [errInfo, Info] = [AppUtility.errorInfo, AppUtility.info]
let routes = [{
 type: 'GET',
 path: '/AB',
 requesthandler: (req, res) => {
    Info('success', 'AB', 5 )
    res.status(200).send(AppUtility.generate({error: false, message: 'success', status: 0, data: {AB: 'AB'}}))
}
 }, 
{type: 'POST',
 path: '/CD', 
 requesthandler: (req, res) => {
    Info('success', 'CD', 5 );
    res.status(200).send(AppUtility.generate({error: false, message: 'success', status: 0, data: {AB: req.body.cd}}))
}
 }
];
let application = new initiateExpress({routes})
application.initiateAppEngine();
module.exports ={app: application.app}

// in google function just put app in Function to execute input box.

Tests

npm run test

curl --location --request POST 'http://localhost:4000/CD' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'cd=sdsfsdfsd'

Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

/google-function-http-tool/

    Package Sidebar

    Install

    npm i google-function-http-tool

    Weekly Downloads

    3

    Version

    1.0.18

    License

    GNU GPLv3

    Unpacked Size

    50.9 kB

    Total Files

    5

    Last publish

    Collaborators

    • darkie8