Skip to content

Commit

Permalink
Fix sqlite proxy docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AndriiSherman committed Feb 5, 2023
1 parent 7ec585f commit a9d72c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions examples/sqlite-proxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ app.post('/query', (req, res) => {
}
} else if (method === 'get') {
try {
const row = this.db.prepare(sql).raw().get(params);
return { data: row };
const row = db.prepare(sqlBody).raw().get(params);
res.send(row);
} catch (e: any) {
return { error: e.message };
res.status(500).json({ error: e.message });
}
} else {
res.status(500).json({ error: 'Unkown method value' });
Expand Down
8 changes: 4 additions & 4 deletions examples/sqlite-proxy/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ app.post('/query', (req, res) => {
} catch (e: any) {
res.status(500).json({ error: e.message });
}
}else if (method === 'get') {
} else if (method === 'get') {
try {
const row = db.prepare(sqlBody).raw().get(params);
return { data: row };
res.send(row);
} catch (e: any) {
return { error: e.message };
res.status(500).json({ error: e.message });
}
} else {
res.status(500).json({ error: 'Unkown method value' });
Expand All @@ -48,7 +48,7 @@ app.post('/migrate', (req, res) => {
} catch (e: any) {
db.exec('ROLLBACK');
}

res.send({});
});

Expand Down

0 comments on commit a9d72c1

Please sign in to comment.