Skip to content

Commit

Permalink
adding isTor proxy api
Browse files Browse the repository at this point in the history
  • Loading branch information
sairaj-mote committed Jan 15, 2024
1 parent f0eef56 commit 0d426e3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
5 changes: 2 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,13 @@ const hash = require('./routes/hash')
app.use("/hash", hash);
const priceHistory = require('./routes/price-history')
app.use("/price-history", priceHistory);
const isTor = require('./routes/is-tor')
app.use("/is-tor", isTor);

// Start the server
app.listen(PORT, HOST, () => {
console.log(`Server is running at http://${HOST}:${PORT}`);
});
// TODO
//https://utility-api.ranchimall.net/hash/gitwh


// Export the Express API
module.exports = app;
2 changes: 1 addition & 1 deletion index.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions routes/is-tor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const express = require('express');
const router = express.Router();
const axios = require('axios');

router.get('/', async (req, res) => {
try {
const response = await axios.get('https://check.torproject.org/api/ip');
const isTor = response.data.IsTor;
res.json({ isTor });
} catch (error) {
res.status(500).json({ error: error.message });
}
});

module.exports = router;
1 change: 1 addition & 0 deletions routes/is-tor.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0d426e3

Please sign in to comment.