Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4a85e5d

Browse files
committed
Added pages/hello.vue, interfacing with lambda
1 parent 0820764 commit 4a85e5d

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

‎netlify.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Doc: https://www.netlify.com/docs/netlify-toml-reference/
12
[build]
2-
command = "yarn generate"
3+
command = "yarn build"
4+
functions = "lambdas-dist"
35
publish = "dist"

‎pages/hello.vue

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<template>
2+
<div>
3+
<h2>Hello, World!</h2>
4+
<b-btn variant="primary" @click="helloWorld()">Hello</b-btn>
5+
<p>Response: {{ response }}</p>
6+
<p v-if="error">
7+
<strong>Error {{ error.status }}</strong>
8+
<br />
9+
{{ error.data }}
10+
</p>
11+
</div>
12+
</template>
13+
14+
<script>
15+
export default {
16+
head() {
17+
return {
18+
title: 'Nuxt Netlify Lambda - Home',
19+
meta: [
20+
{
21+
hid: 'description',
22+
name: 'description',
23+
content: 'Nuxt Netlify Lambda Home description'
24+
}
25+
]
26+
}
27+
},
28+
data() {
29+
return {
30+
response: '',
31+
error: null
32+
}
33+
},
34+
methods: {
35+
async helloWorld() {
36+
try {
37+
const res = await this.$axios.$get('/.netlify/functions/hello')
38+
this.response = res
39+
this.error = null
40+
} catch (e) {
41+
this.error = e.response
42+
this.response = ''
43+
}
44+
}
45+
}
46+
}
47+
</script>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /