mirror of
https://github.com/Lissy93/web-check.git
synced 2025-08-19 08:51:55 +02:00
Convert all API endpoints into ESM modules
This commit is contained in:
14
api/whois.js
14
api/whois.js
@@ -1,7 +1,7 @@
|
||||
const net = require('net');
|
||||
const psl = require('psl');
|
||||
const axios = require('axios');
|
||||
const middleware = require('./_common/middleware');
|
||||
import net from 'net';
|
||||
import psl from 'psl';
|
||||
import axios from 'axios';
|
||||
import middleware from './_common/middleware.js';
|
||||
|
||||
const getBaseDomain = (url) => {
|
||||
let protocol = '';
|
||||
@@ -83,7 +83,7 @@ const fetchFromMyAPI = async (hostname) => {
|
||||
}
|
||||
};
|
||||
|
||||
const handler = async (url) => {
|
||||
const whoisHandler = async (url) => {
|
||||
if (!url.startsWith('http://') && !url.startsWith('https://')) {
|
||||
url = 'http://' + url;
|
||||
}
|
||||
@@ -106,6 +106,6 @@ const handler = async (url) => {
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = middleware(handler);
|
||||
module.exports.handler = middleware(handler);
|
||||
export const handler = middleware(whoisHandler);
|
||||
export default handler;
|
||||
|
||||
|
Reference in New Issue
Block a user