Last active
November 6, 2018 11:52
-
-
Save serinuntius/816c744966c17e3a68f21ce819f322d5 to your computer and use it in GitHub Desktop.
firebaseとexpressの最小構成サンプル(?)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functions = require('firebase-functions'); | |
const express = require("express"); | |
const app = express(); | |
app.get('/hoge', (req, res) => { | |
res.send('hoge') | |
}); | |
const api = functions.https.onRequest(app); | |
module.exports = {api}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
上記コードは動作確認をしておりません。
動いてるコードを最小構成にしたらこんな感じになりました。
基本的には
あたりをしておけば問題ないと思います。
ハマるかもしれないポイントは、
module.exports = {api};
で渡してるので自動的に/api
というネームスペースが切られるところでしょうか?curl <host>/api/hoge
でアクセスできるはずです。