You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
407 B
19 lines
407 B
// helper function(s?) to make a query to the database
|
|
|
|
const db_url = 'http://localhost:8000'
|
|
|
|
async function query(q, params) {
|
|
return fetch(db_url, {
|
|
method: 'POST',
|
|
headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({
|
|
statements: [{
|
|
q: q,
|
|
params: params
|
|
}]
|
|
})
|
|
}).then((res) => res.json())
|
|
.then((data) => data[0].results);
|
|
}
|
|
|
|
module.exports = { query: query }; |