mirror of
https://github.com/Lissy93/web-check.git
synced 2025-08-08 20:54:30 +02:00
Convert all API endpoints into ESM modules
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
const dns = require('dns');
|
||||
const middleware = require('./_common/middleware');
|
||||
import dns from 'dns';
|
||||
import middleware from './_common/middleware.js';
|
||||
|
||||
const lookupAsync = (address) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -13,11 +13,11 @@ const lookupAsync = (address) => {
|
||||
});
|
||||
};
|
||||
|
||||
const handler = async (url) => {
|
||||
const ipHandler = async (url) => {
|
||||
const address = url.replaceAll('https://', '').replaceAll('http://', '');
|
||||
return await lookupAsync(address);
|
||||
};
|
||||
|
||||
|
||||
module.exports = middleware(handler);
|
||||
module.exports.handler = middleware(handler);
|
||||
export const handler = middleware(ipHandler);
|
||||
export default handler;
|
||||
|
Reference in New Issue
Block a user