mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-11 12:58:32 +03:00
Clean master commit
This commit is contained in:
28
src/lib/blueprinters.js
Normal file
28
src/lib/blueprinters.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
|
||||
const REL_PATH_TO_BPS = "../blueprinters";
|
||||
const allBps = {};
|
||||
|
||||
export const defaultBlueprint = {
|
||||
name: null,
|
||||
id: null,
|
||||
dialects: ["rest"], // supported dialects, can (eventually) be multiple
|
||||
routes: {}
|
||||
};
|
||||
|
||||
export const defaultRoute = {
|
||||
options: {
|
||||
fragment: true
|
||||
},
|
||||
data: []
|
||||
};
|
||||
|
||||
// import all default exports from 'blueprinters' folder
|
||||
const normalizedPath = path.join(__dirname, REL_PATH_TO_BPS);
|
||||
fs.readdirSync(normalizedPath).forEach(file => {
|
||||
const bpName = file.replace(".js", "");
|
||||
allBps[bpName] = require(`${REL_PATH_TO_BPS}/${file}`).default;
|
||||
});
|
||||
|
||||
module.exports = allBps;
|
||||
Reference in New Issue
Block a user