mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Add listing vercel function
This commit is contained in:
parent
f1750ef4aa
commit
22d601abbe
1 changed files with 42 additions and 0 deletions
42
api/listings/listing.js
Normal file
42
api/listings/listing.js
Normal 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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue