You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
464 B
JavaScript
19 lines
464 B
JavaScript
2 years ago
|
import fetch from 'node-fetch'
|
||
|
import { readFile } from 'fs/promises'
|
||
|
|
||
|
export async function getBuildRoutesMetadata(file) {
|
||
|
console.log('Loading routes from disk...')
|
||
|
|
||
|
const routesRaw = await readFile(file, 'utf8')
|
||
|
return JSON.parse(routesRaw)
|
||
|
}
|
||
|
|
||
|
export async function getDevRoutesMetadata(url) {
|
||
|
console.log('Loading routes from go server...')
|
||
|
|
||
|
const routesReq = await fetch(url)
|
||
|
const routes = await routesReq.json()
|
||
|
|
||
|
return routes
|
||
|
}
|