@ahamove/ahaless
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

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

Dependents (0)

Package Sidebar

Install

npm i @ahamove/ahaless

Weekly Downloads

35

Version

0.1.4

License

MIT

Unpacked Size

25.2 kB

Total Files

25

Last publish

Collaborators

  • thangden
  • khoand2914
  • vunh-ahamove
  • lynkxyz
  • thucnc