Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Google Cloud Functions / Azure Functions #6

Closed
rochdev opened this issue Dec 17, 2016 · 10 comments
Closed

Support for Google Cloud Functions / Azure Functions #6

rochdev opened this issue Dec 17, 2016 · 10 comments

Comments

@rochdev
Copy link
Contributor

rochdev commented Dec 17, 2016

I think it would be great as by supporting all providers this project has the potential to become the one serverless framework to rule them all. I don't know if this would fit the current scope of the project though.

Otherwise I am thinking maybe of making another project using this one as its "lambda" adapter.

@dougmoscrop
Copy link
Owner

Interesting - I am up for it! I also know that the Serverless people are looking at making a generic function handler type interface: (I think the discussion is here: serverless/fdk#14)

So I was thinking I might eventually move to 'that' interface -- thoughts?

@cometta
Copy link

cometta commented Mar 12, 2017

how soon will you add support for GCF?

@dougmoscrop
Copy link
Owner

Google Cloud functions look almost like they have their own version of this module anyway "internally" because they give you a req and res object in their handler.

Have you tried just

app = koa()
...
app.callback()(req, res)

Without any library help?

@cometta
Copy link

cometta commented Mar 12, 2017

yup, it's working.

@dougmoscrop
Copy link
Owner

I'm always up for PRs that can help with any issues around GCF or Azure

@unixfox
Copy link

unixfox commented Oct 17, 2018

Do you have an idea/quick fix to make my function working on Azure?
Here is my code:

const express = require('express')
const sls = require('serverless-http')
const app = express()
app.get('/', function (req, res) {
  res.send('Hello World!')
})
module.exports.server = sls(app)

@dougmoscrop
Copy link
Owner

dougmoscrop commented Oct 17, 2018 via email

@unixfox
Copy link

unixfox commented Oct 18, 2018

Here is an example of serverless for Azure: https://github.com/serverless/serverless/blob/master/lib/plugins/create/templates/azure-nodejs/handler.js

And if you need a pure example, here is this code took from the official documentation:

module.exports = async function (context, req) {
    context.log('JavaScript HTTP trigger function processed a request.');
    // You can call and await an async method here
    return {
        body: "Hello, world!"
    };
}

Link of the documentation: https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node

@dougmoscrop
Copy link
Owner

I refactored this library to support multiple providers, however I don't have any plans to implement them. PRs are welcome.

@joshuaquek
Copy link

Where can we find this refactored version? Would there be a branch for this?

@dougmoscrop dougmoscrop closed this as not planned Won't fix, can't repro, duplicate, stale Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants