backend/fastify/delete-strategy/server.js
2024-05-26 22:28:08 +02:00

22 lines
439 B
JavaScript
Executable File

// Declare a route
module.exports = function (fastify, opts, done) {
const pb = opts.pb;
fastify.post('/delete-strategy', async (request, reply) => {
const data = request.body;
let output;
try {
await pb.collection("stockscreener").delete(data['strategyId'])
output = 'success';
}
catch(e) {
output = 'failure';
}
reply.send({ items: output })
});
done();
};