0.0.1 • Published 6 years ago

@cloudful/cloudful v0.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

cloudful

cloudful is a more optimistic way of building services on fully managed cloud services (aka serverless). The cloudful framework uses metadata backed types to generate all the information it needs to create services using fully managed cloud services, such as Azure Functions and Azure Cosmos DB. It is currently focused on Node.js and TypeScript/JavaScript developers. It uses some experimental features like system-metadata and @decorators.

import { Binding, FunctionHost, Fx, HttpTrigger, HttpTriggerBinding, IBinding, IFunctionConfig, } from "@cloudful/cloudful";

class MyFunc {
    private myhttp(context: Context, @HttpTrigger("req") req: any) {
        context.log("I'm an http function");
        context.done();
    }
}

const host: FunctionHost = new FunctionHost();
host.register(MyFunc);

export default host;

Getting started

See the (hello world sample)./sample/hello for a simple intro

  • package.json
{
  "dev-dependencies":{
    "@cloudful/cloudful":"*",
    "typescript":"*"
  },
  "build":"tsc && cloudful build ./lib"
}
  • tsconfig.json
{
  "compilerOptions": {
    "declaration": true,
    "module": "commonjs",
    "moduleResolution": "node",
    "noImplicitAny": true,
    "outDir": "./lib",
    "preserveConstEnums": true,
    "removeComments": true,
    "target": "es6",
    "sourceMap": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true
  },
  "include": [
    "**/*.ts"
  ],
  "exclude": [
    "node_modules",
    "**/*-spec.ts"
  ]
}
  • ./index.ts
import { Binding, FunctionHost, Fx, HttpTrigger, HttpTriggerBinding, IBinding, IFunctionConfig, } from "@cloudful/cloudful";

class MyFunc {
    private myhttp(context: Context, @HttpTrigger("req") req: any) {
        context.log("I'm an http function");
        context.done();
    }

    @Fx({
        excluded: true,
        bindings: [{
            name: "item",
            type: "queueTrigger",
            direction: "in",
            connection: "AzureWebJobsStorage",
        }],
    })
    private foobar(context: Context) {
        context.log("foobar");
        context.done();
    }
}

const host: FunctionHost = new FunctionHost();
host.register(MyFunc);

export default host;

License

MIT