DEV Community

darkie8
darkie8

Posted on

Easy serverless google function creation with all the goodness of EXPRESS !

Hello.

I am new to contributing to opensource. And I am starting this exciting journey by writing npm packages. Recently I wrote a simple google function creator library, it makes your google function / any serverless / Express code small with default provided setting; you just have to add what you need to add , no more unnecessary coding, no CORS problem! Everything is configured , and also can be fine tuned with custom stuff. You can create normal express app too with this library.
here is the link and the basic usage has been described. For further customization , you can see the index.ts/index.d.ts file inside the source. Updated readme will be provided later.

npm Link

https://www.npmjs.com/package/google-function-http-tool

Git Repo

GitHub logo darkie8 / 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.

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}}))
…

Conclusion

Just use it and give me feedback ,I will love to get new idea on this one.

Top comments (0)