app.listen(PORT, "127.0.0.1", () => console.log("API started on http://127.0.0.1:"+PORT));
app.get("/", (req, res) => {
- res.status(400).send({"message":"use /blocker or /blocked endpoint"});
+ res.status(400).json({"message":"use /blocker or /blocked endpoint"});
});
app.get("/blocker", (req, res) => {
- res.status(400).send({"message":"insert a domain"});
+ res.status(400).json({"message":"insert a domain"});
});
app.get("/blocked", (req, res) => {
- res.status(400).send({"message":"insert a domain"});
+ res.status(400).json({"message":"insert a domain"});
});
function get_blocker(blocker, _callback, _err_callback) {
const {domain} = req.params;
get_blocker(
domain,
- result => res.status(200).send(result),
- err => res.status(500).send({"message": err}),
+ result => res.status(200).json(result),
+ err => res.status(500).json({"message": err}),
);
});
const {domain} = req.params;
get_blocked(
domain,
- result => res.status(200).send(result),
- err => res.status(500).send({"message": err}),
+ result => res.status(200).json(result),
+ err => res.status(500).json({"message": err}),
);
});
app.listen(PORT, "127.0.0.1", () => console.log("API started on http://127.0.0.1:"+PORT));
app.get("/", (req, res) => {
- res.status(400).send({"message":"insert a domain"});
+ res.status(400).json({"message":"insert a domain"});
});
app.get("/:domain", (req, res) => {
const {domain} = req.params;
- main(domain, data => res.status(200).send({
+ main(domain, data => res.status(200).json({
"reject": data.reject,
"media_removal": data.media_removal,
"federated_timeline_removal": data.federated_timeline_removal,