From a9a577e1c9f225f909b31b795d4cffc47b3c68ef Mon Sep 17 00:00:00 2001
From: Xiao Gui <xgui3783@gmail.com>
Date: Sun, 17 May 2020 13:02:07 +0200
Subject: [PATCH] init commit functions

---
 functions/templates.js       | 12 ++++++++++++
 functions/templates/colin.js | 12 ++++++++++++
 netlify.toml                 |  6 +++++-
 3 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100644 functions/templates.js
 create mode 100644 functions/templates/colin.js

diff --git a/functions/templates.js b/functions/templates.js
new file mode 100644
index 000000000..212fc4fe5
--- /dev/null
+++ b/functions/templates.js
@@ -0,0 +1,12 @@
+exports.handler = (ev, ctx, cb) => {
+  const resp = {
+    hello: 'world'
+  }
+  cb(null, {
+    status: 400,
+    body: JSON.stringify(resp),
+    headers: {
+      'Content-type': 'application/json'
+    }
+  })
+}
\ No newline at end of file
diff --git a/functions/templates/colin.js b/functions/templates/colin.js
new file mode 100644
index 000000000..dedbac514
--- /dev/null
+++ b/functions/templates/colin.js
@@ -0,0 +1,12 @@
+exports.handler = (ev, ctx, cb) => {
+  const resp = {
+    foo: 'bar'
+  }
+  cb(null, {
+    status: 400,
+    body: JSON.stringify(resp),
+    headers: {
+      'Content-type': 'application/json'
+    }
+  })
+}
\ No newline at end of file
diff --git a/netlify.toml b/netlify.toml
index 27a266b81..eac25e66d 100644
--- a/netlify.toml
+++ b/netlify.toml
@@ -2,4 +2,8 @@
 
 [build]
   publish="dist/aot/"
-  command="npm run build-aot"
\ No newline at end of file
+  command="npm run build-aot"
+  functions=".netlify/functions/"
+  environment={
+    BACKEND_URL="netlify_functions"
+  }
\ No newline at end of file
-- 
GitLab