LoginSignup
1
0

More than 1 year has passed since last update.

Azure Functions - 共通コード管理

Last updated at Posted at 2022-02-23

フォルダー構成

フォルダー構成を参考に以下構成で実施

FunctionsProject
  │
  ├─ HttpTrigger1/
  │   ├─ function.json
  │   ├─ index.js
  │   └─ sample.dat
  │
  ├─ SharedCode/
  │   └─ util.js
  │
  ├─ node_modules/
  ├─ .funcignore
  ├─ .gitignore
  ├─ host.json
  ├─ local.settings.json
  ├─ package.json
  └─ package-lock.json

共通コードの実装

SharedCode/util.js
module.exports = {
  testFunction: (context, param) => {
    context.log(param);
  },
};

共通コードの使用

HttpTrigger1/index.js
const util = require('../SharedCode/util');

module.exports = async function (context, req) {
  util.testFunction(context, 'hello world');
};

1
0
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
0