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,9 +1,8 @@
const middleware = require('./_common/middleware');
import dns from 'dns';
import URL from 'url-parse';
import middleware from './_common/middleware.js';
const dns = require('dns').promises;
const URL = require('url-parse');
const handler = async (url, event, context) => {
const mailConfigHandler = async (url, event, context) => {
try {
const domain = new URL(url).hostname || new URL(url).pathname;
@ -77,5 +76,5 @@ const handler = async (url, event, context) => {
}
};
module.exports = middleware(handler);
module.exports.handler = middleware(handler);
export const handler = middleware(mailConfigHandler);
export default handler;