@ahamove/ahaless

Write serverless with Typescript

Usage no npm install needed!

<script type="module">
  import ahamoveAhaless from 'https://cdn.skypack.dev/@ahamove/ahaless';
</script>

README

Ahaless

Write serverless application on top of Typescript

Installation

To install the AhaLess library into an existing project, use the yarn CLI

yarn add @ahamove/ahaless 
yarn add serverless-webpack @ahamove/serverless-generate-functions -D

or the npm CLI

npm install @ahamove/ahaless
npm add serverless-webpack @ahamove/serverless-generate-functions -D

Examples

We have several examples on the website. Here is the first one to get you started

// ./src/hello/hello.service.ts

import { injectable } from '@ahamove/ahaless'

@injectable()
export class HelloService {
  async hello() {
    return 'Hello world'
  }
}
// ./src/hello/hello.handler.ts

import { HelloService } from './hello.service'
import { handler, get, param } from '@ahamove/ahaless'

@handler()
export class HelloHandler {
  constructor(private readonly helloService: HelloService) {
  }

  @get()
  async hello() {
    return this.helloService.hello()
  }
}
// ./src/hello/hello.module.ts

import { module } from '@ahamove/ahaless'
import { HelloHandler } from './src/hello.handler'

@module({
  handlers: [HelloHandler],
  providers: [HelloService]
})
export class HelloModule {}
// ./handler.ts

import { module } from '@ahamove/ahaless'
import { HelloModule } from './src/hello/hello.module'

@module({
  imports: [HelloModule],
})
export class Handler {
  static exports = exports
}

Add the plugin @ahamove/serverless-gen-functions to your serverless.yml file:

plugins:
  - serverless-dotenv-plugin
  - serverless-offline
  - serverless-webpack
  - @ahamove/serverless-generate-functions

After that, when you want to generate list functions. You can simply run the command line with option --gf:

sls offline --env staging --gf

Stay in touch

  • Company - AhaMove

License

Ahaless is MIT licensed