LoginSignup
1
3

More than 5 years have passed since last update.

[覚書]ServerlessフレームワークをTypeScriptで書くためのテンプレート

Last updated at Posted at 2016-12-22

タイトルどおり、ServerlessフレームワークをTypeScriptで書くためのテンプレートを作ってGitHubにあげといたのでメモ。

使い方

あらかじめAWS Lambdaの設定などはしておくこと。
設定に関しては、Serverless FrameworkでLINE BOTが簡単にできちゃったあたりを参照のこと。

bash
$ git clone https://github.com/JunSuzukiJapan/sls-ts-template.git
$ npm install

としたら、src/serverless.ymlの中の

service: sls-ts-template

という行を

service: 自分のプロジェクト名

に変更しておく。

あとは、

$ make build

でビルド。

$ make local

でローカル環境でのテストを行う。

デプロイは

$ make deploy

参考

Serverless+TypeScriptの開発環境を作る

補足:npmのモジュールを実行時に読み込むためには

src/ディレクトリで、パッケージをインストールする必要があります。
(.zipで固めるときに一緒にパックする必要があるため)。

具体的には、

$ cd src; npm install --save パッケージ名
1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3