aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/invoice.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/invoice.js')
-rw-r--r--src/routes/invoice.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/routes/invoice.js b/src/routes/invoice.js
new file mode 100644
index 00000000..fa493fe1
--- /dev/null
+++ b/src/routes/invoice.js
@@ -0,0 +1,20 @@
+import got from 'got';
+
+const username = 'bob',
+ network = 'lightning';
+
+export async function GET({ params }) {
+ let text = await got
+ .post('http://localhost:3119/lightning/invoice', {
+ json: { amount: 100 }
+ })
+ .text();
+
+ let body = await got
+ .post('http://localhost:3119/invoice', {
+ json: { invoice: { text, network }, user: { username } }
+ })
+ .json();
+
+ return { body };
+}