Skip to content

Commit bdef6b4

Browse files
committed
Set up Netlify Functions
1 parent ec43d10 commit bdef6b4

File tree

6 files changed

+70
-8
lines changed

6 files changed

+70
-8
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ Thumbs.db
2727

2828
# Folders to ignore
2929
dist/*
30+
/functions
3031
node_modules

netlify.toml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[build]
2+
# This will be your default build command.
3+
command = "npm run build"
4+
# This is where Netlify will look for your lambda functions.
5+
functions = "functions"
6+
# This is the directory that you are publishing from.
7+
publish = "dist"

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"license": "MIT",
77
"private": true,
88
"scripts": {
9-
"serve": "vue-cli-service serve",
10-
"build": "vue-cli-service build",
9+
"serve": "netlify-lambda serve src-functions & vue-cli-service serve",
10+
"build": "netlify-lambda build src-functions && vue-cli-service build",
1111
"lint": "vue-cli-service lint"
1212
},
1313
"dependencies": {
@@ -21,6 +21,7 @@
2121
"graphql": "^14.1.1",
2222
"graphql-tag": "^2.9.0",
2323
"graphql-type-json": "^0.2.1",
24+
"netlify-lambda": "^1.2.0",
2425
"node-sass": "^4.11.0",
2526
"node-sass-magic-importer": "^5.3.0",
2627
"reset-css": "^4.0.1",

src-functions/graphql.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
exports.handler = () => {};

vue.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,13 @@ module.exports = {
88
},
99
},
1010
},
11+
devServer: {
12+
proxy: {
13+
'/.netlify': {
14+
target: `http://localhost:9000`,
15+
pathRewrite: { '^/.netlify/functions': `` },
16+
},
17+
},
18+
},
1119
lintOnSave: false,
1220
};

yarn.lock

+50-6
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@
306306
"@babel/helper-plugin-utils" "^7.0.0"
307307
"@babel/plugin-syntax-json-strings" "^7.2.0"
308308

309-
"@babel/plugin-proposal-object-rest-spread@^7.2.0":
309+
"@babel/plugin-proposal-object-rest-spread@^7.0.0", "@babel/plugin-proposal-object-rest-spread@^7.2.0":
310310
version "7.2.0"
311311
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.2.0.tgz#88f5fec3e7ad019014c97f7ee3c992f0adbf7fb8"
312312
integrity sha512-1L5mWLSvR76XYUQJXkd/EEQgjq8HHRP6lQuZTTg0VA4tTGPpGemmCdAfQIz1rzEuWAm+ecP8PyyEm30jC1eQCg==
@@ -525,6 +525,13 @@
525525
dependencies:
526526
"@babel/helper-plugin-utils" "^7.0.0"
527527

528+
"@babel/plugin-transform-object-assign@^7.0.0":
529+
version "7.2.0"
530+
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-assign/-/plugin-transform-object-assign-7.2.0.tgz#6fdeea42be17040f119e38e23ea0f49f31968bde"
531+
integrity sha512-nmE55cZBPFgUktbF2OuoZgPRadfxosLOpSgzEPYotKSls9J4pEPcembi8r78RU37Rph6UApCpNmsQA4QMWK9Ng==
532+
dependencies:
533+
"@babel/helper-plugin-utils" "^7.0.0"
534+
528535
"@babel/plugin-transform-object-super@^7.2.0":
529536
version "7.2.0"
530537
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.2.0.tgz#b35d4c10f56bab5d650047dad0f1d8e8814b6598"
@@ -1835,7 +1842,7 @@ babel-helper-vue-jsx-merge-props@^2.0.3:
18351842
resolved "https://registry.yarnpkg.com/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz#22aebd3b33902328e513293a8e4992b384f9f1b6"
18361843
integrity sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg==
18371844

1838-
babel-loader@^8.0.4:
1845+
babel-loader@^8.0.0, babel-loader@^8.0.4:
18391846
version "8.0.5"
18401847
resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.0.5.tgz#225322d7509c2157655840bba52e46b6c2f2fe33"
18411848
integrity sha512-NTnHnVRd2JnRqPC0vW+iOQWU5pchDbYXsG2E6DMXEpMfUcQKclF9gmf3G3ZMhzG7IG9ji4coL0cm+FxeWxDpnw==
@@ -2565,7 +2572,7 @@ [email protected], commander@~2.17.1:
25652572
resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
25662573
integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==
25672574

2568-
commander@^2.18.0:
2575+
commander@^2.17.1, commander@^2.18.0:
25692576
version "2.19.0"
25702577
resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a"
25712578
integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==
@@ -3862,6 +3869,13 @@ expand-tilde@^2.0.0, expand-tilde@^2.0.2:
38623869
dependencies:
38633870
homedir-polyfill "^1.0.1"
38643871

3872+
express-logging@^1.1.1:
3873+
version "1.1.1"
3874+
resolved "https://registry.yarnpkg.com/express-logging/-/express-logging-1.1.1.tgz#62839618cbab5bb3610f1a1c1485352fe9d26c2a"
3875+
integrity sha1-YoOWGMurW7NhDxocFIU1L+nSbCo=
3876+
dependencies:
3877+
on-headers "^1.0.0"
3878+
38653879
express@^4.16.2, express@^4.16.3, express@^4.16.4:
38663880
version "4.16.4"
38673881
resolved "https://registry.yarnpkg.com/express/-/express-4.16.4.tgz#fddef61926109e24c515ea97fd2f1bdbf62df12e"
@@ -5543,6 +5557,11 @@ jsprim@^1.2.2:
55435557
json-schema "0.2.3"
55445558
verror "1.10.0"
55455559

5560+
jwt-decode@^2.2.0:
5561+
version "2.2.0"
5562+
resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-2.2.0.tgz#7d86bd56679f58ce6a84704a657dd392bba81a79"
5563+
integrity sha1-fYa9VmefWM5qhHBKZX3TkruoGnk=
5564+
55465565
killable@^1.0.0:
55475566
version "1.0.1"
55485567
resolved "https://registry.yarnpkg.com/killable/-/killable-1.0.1.tgz#4c8ce441187a061c7474fb87ca08e2a638194892"
@@ -6165,6 +6184,26 @@ neo-async@^2.5.0:
61656184
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.0.tgz#b9d15e4d71c6762908654b5183ed38b753340835"
61666185
integrity sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA==
61676186

6187+
netlify-lambda@^1.2.0:
6188+
version "1.2.0"
6189+
resolved "https://registry.yarnpkg.com/netlify-lambda/-/netlify-lambda-1.2.0.tgz#8e9bf370c81e2b4e335442ccf67ff2583df34c48"
6190+
integrity sha512-hYbh/niRAB9347Ix7flWdtzfMvq0vyOOB2003Xt/UfV5+SSyzSM8Pksj+KIk3HMwc2zkj9W3P0EKv6nS3ie15w==
6191+
dependencies:
6192+
"@babel/core" "^7.0.0"
6193+
"@babel/plugin-proposal-class-properties" "^7.0.0"
6194+
"@babel/plugin-proposal-object-rest-spread" "^7.0.0"
6195+
"@babel/plugin-transform-object-assign" "^7.0.0"
6196+
"@babel/preset-env" "^7.0.0"
6197+
babel-loader "^8.0.0"
6198+
body-parser "^1.18.3"
6199+
commander "^2.17.1"
6200+
express "^4.16.3"
6201+
express-logging "^1.1.1"
6202+
jwt-decode "^2.2.0"
6203+
toml "^2.3.3"
6204+
webpack "^4.17.1"
6205+
webpack-merge "^4.1.4"
6206+
61686207
nice-try@^1.0.4:
61696208
version "1.0.5"
61706209
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
@@ -6514,7 +6553,7 @@ on-finished@~2.3.0:
65146553
dependencies:
65156554
ee-first "1.1.1"
65166555

6517-
on-headers@~1.0.1:
6556+
on-headers@^1.0.0, on-headers@~1.0.1:
65186557
version "1.0.1"
65196558
resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.0.1.tgz#928f5d0f470d49342651ea6794b0857c100693f7"
65206559
integrity sha1-ko9dD0cNSTQmUepnlLCFfBAGk/c=
@@ -8774,6 +8813,11 @@ [email protected]:
87748813
resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553"
87758814
integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==
87768815

8816+
toml@^2.3.3:
8817+
version "2.3.5"
8818+
resolved "https://registry.yarnpkg.com/toml/-/toml-2.3.5.tgz#a1f5d7f7efd300fa426258f3e74374536191e3db"
8819+
integrity sha512-ulY/Z2yPWKl/3JvGJvnEe7mXqVt2+TtDoRxJNgTAwO+3lwXefeCHS697NN0KRy6q7U/b1MnSnj/UGF/4U0U2WQ==
8820+
87778821
87788822
version "3.0.3"
87798823
resolved "https://registry.yarnpkg.com/topo/-/topo-3.0.3.tgz#d5a67fb2e69307ebeeb08402ec2a2a6f5f7ad95c"
@@ -9356,7 +9400,7 @@ webpack-log@^2.0.0:
93569400
ansi-colors "^3.0.0"
93579401
uuid "^3.3.2"
93589402

9359-
webpack-merge@^4.1.5:
9403+
webpack-merge@^4.1.4, webpack-merge@^4.1.5:
93609404
version "4.2.1"
93619405
resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-4.2.1.tgz#5e923cf802ea2ace4fd5af1d3247368a633489b4"
93629406
integrity sha512-4p8WQyS98bUJcCvFMbdGZyZmsKuWjWVnVHnAS3FFg0HDaRVrPbkivx2RYCre8UiemD67RsiFFLfn4JhLAin8Vw==
@@ -9371,7 +9415,7 @@ webpack-sources@^1.1.0, webpack-sources@^1.3.0:
93719415
source-list-map "^2.0.0"
93729416
source-map "~0.6.1"
93739417

9374-
webpack@4:
9418+
webpack@4, webpack@^4.17.1:
93759419
version "4.28.4"
93769420
resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.28.4.tgz#1ddae6c89887d7efb752adf0c3cd32b9b07eacd0"
93779421
integrity sha512-NxjD61WsK/a3JIdwWjtIpimmvE6UrRi3yG54/74Hk9rwNj5FPkA4DJCf1z4ByDWLkvZhTZE+P3C/eh6UD5lDcw==

0 commit comments

Comments
 (0)