Convert all API endpoints into ESM modules

This commit is contained in:
Alicia Sykes
2024-05-06 21:51:32 +01:00
parent e255c358cb
commit c9e57400fd
34 changed files with 191 additions and 194 deletions

View File

@ -1,5 +1,5 @@
const axios = require('axios');
const middleware = require('./_common/middleware');
import axios from 'axios';
import middleware from './_common/middleware.js';
const hasWaf = (waf) => {
return {
@ -7,7 +7,7 @@ const hasWaf = (waf) => {
}
};
const handler = async (url) => {
const firewallHandler = async (url) => {
const fullUrl = url.startsWith('http') ? url : `http://${url}`;
try {
@ -102,5 +102,5 @@ const handler = async (url) => {
}
};
module.exports = middleware(handler);
module.exports.handler = middleware(handler);
export const handler = middleware(firewallHandler);
export default handler;