Add listing vercel function

This commit is contained in:
Sam Carlton 2021-09-18 14:29:57 -05:00
parent f1750ef4aa
commit 22d601abbe

42
api/listings/listing.js Normal file
View file

@ -0,0 +1,42 @@
import { getJsonDirectory } from '@/helpers/get-json-directory.js'
let jsonDirectory
class Listing {
constructor() {
// // The doc that contains the sheet
// this.doc = null
// // The sheet for out data
// this.sheet = null
// // The sheet for out data
// this.rows = null
}
async handler (req, res) {
// const requestUrl = new URL(req.url, 'https://localhost:3000')
jsonDirectory = await getJsonDirectory()
// console.log('resultInfo', resultInfo)
// Set JSON Header
res.setHeader('Content-Type', 'application/json')
// Repond with JSON Data
res.json( {
jsonDirectory
} )
}
}
export default async function (req, res) {
const lister = new Listing()
return await lister.handler(req, res)
}