3 ms·
You can also use RPC to securely expose SQL queries. This is for example what Wildcard API (https://github.com/reframejs/wildcard-api https://github.com/reframe
by brillout 6y ago
You can also use RPC to securely expose SQL queries. This is for example what Wildcard API (https://github.com/reframejs/wildcard-api https://github.com/reframejs/wildcard-api) does:
endpoints.deletePost = async function(postId){
// Only admins are allowed to remove a post
if( !this.user.isAdmin ) return {permissionDenied: true};
await db.query("DELETE FROM posts WHERE id = :postId;", {postId});
return {deleteSuccess: true};
};