@ahamove/ahaless
v0.1.4
Published
Write serverless with Typescript
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 -Dor the npm CLI
npm install @ahamove/ahaless
npm add serverless-webpack @ahamove/serverless-generate-functions -DExamples
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-functionsAfter that, when you want to generate list functions. You can simply run the command line with option --gf:
sls offline --env staging --gfStay in touch
- Company - AhaMove
License
Ahaless is MIT licensed
