aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/invoice.js
blob: 49bcfe70f0d86cd56e47fa3d7a410c5272c77891 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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();

	await got
		.post('http://localhost:3119/invoice', {
			json: { invoice: { text, network }, user: { username } }
		})
		.json();

	return { body: { text } };
}