GithubHelp home page GithubHelp logo

jcmdsbr / nest-cloud-function Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 201 KB

Node Cloud Functions using Nest standalone application is a wrapper around the Nest IoC container

JavaScript 34.46% TypeScript 65.54%

nest-cloud-function's Introduction

[GCP] Cloud functions using nodejs + nestjs ๐Ÿ˜Ž

  • Node Cloud Functions using Nest standalone application is a wrapper around the Nest IoC container

Standalone applications โญ

There are several ways of mounting a Nest application. You can create a web app, a microservice or just a bare Nest standalone application (without any network listeners). The Nest standalone application is a wrapper around the Nest IoC container, which holds all instantiated classes. We can obtain a reference to any existing instance from within any imported module directly using the standalone application object. Thus, you can take advantage of the Nest framework anywhere, including, for example, scripted CRON jobs. You can even build a CLI on top of it.

Getting started โ—

Before โœ”๏ธ

  • Install firebase-tools
npm i -g firebase-tools

Init firebase function strucure โœ”๏ธ

firebase init functions
firebase init emulators

Add Nest to the Functions Source โœ”๏ธ

In functions folder

To create a Nest standalone application and Add , use the following construction:

npm i --save @nestjs/core @nestjs/common rxjs reflect-metadata

If HTTP function install

npm i --save express @nestjs/platform-express
  • Create a nest-cli.json file
{
    "language": "ts",
    "collection": "@nestjs/schematics",
    "sourceRoot": "src"
}

And add new configuration from tsconfig.json

{
  "compilerOptions": {
    "module": "commonjs",
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "outDir": "lib",
    "sourceMap": true,
    "strict": false,
    "target": "es2017",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "declaration": true,
    "removeComments": true,
    "baseUrl": "./",
    "incremental": true,
    "esModuleInterop": true
  },
  "compileOnSave": true,
  "include": [
    "src"
  ]
}

Deploy โœ”๏ธ

firebase login
firebase deploy --only functions --project [YOUR PROJECT NAME] --region [YOUR PROJECT REGION]

nest-cloud-function's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

felipe-julio

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.