This is the template project that's checked out and configured when you run the bando-up command from ljsthw-bandolier. This is where the code really lives.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
import devtools from '../../lib/devtools.js' ;
import fs from 'fs' ;
export const get = async ( req , res ) => {
if ( process . env . DANGER _ADMIN === "1" ) {
// the devtools module contains all of the errors from the service/api.js for api and sockets
// but to get at the svelte errors we have to read debug/errors/svelte.json
let svelte _errors = [ ] ;
try {
const build _config = JSON . parse ( fs . readFileSync ( "./build.json" ) ) ;
for ( let config of build _config ) {
if ( config . errorFile ) {
const meta = JSON . parse ( fs . readFileSync ( config . errorFile ) ) ;
// BUG: probably should just return this raw but let's try only errors/warnings
svelte _errors = svelte _errors . concat ( meta . errors ) ;
}
}
} catch ( error ) {
return res . status ( 404 ) . json ( { message : "File not found." } ) ;
}
return res . status ( 200 ) . json ( {
api : devtools . api ,
sockets : devtools . sockets ,
errors : devtools . errors . concat ( svelte _errors ) } ) ;
} else {
return res . status ( 404 ) . json ( { message : "Not Found." } ) ;
}
}