This is the code that runs https://bandolier.learnjsthehardway.com/ for you to review. It uses the https://git.learnjsthehardway.com/learn-javascript-the-hard-way/bandolier-template to create the documentation for the project.
https://bandolier.learnjsthehardway.com/
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.
22 lines
655 B
22 lines
655 B
import * as models from "../lib/models.js";
|
|
import * as queues from "../lib/queues.js";
|
|
import logging from '../lib/logging.js';
|
|
import assert from 'assert';
|
|
import { API } from '../lib/api.js';
|
|
|
|
const log = logging.create(import.meta.url);
|
|
|
|
<% for(let method in methods) { %>
|
|
export const <%- method.toLowerCase() %> = async (req, res) => {
|
|
const api = new API(req, res);
|
|
const reply_data = <%= JSON.stringify(methods[method][1], null, 4) %>
|
|
|
|
try {
|
|
log.debug(reply_data);
|
|
api.reply(<%- methods[method][0] %>, reply_data);
|
|
} catch (error) {
|
|
log.error(error);
|
|
api.error(500, error.message || "Internal Server Error");
|
|
}
|
|
}
|
|
<% } %>
|
|
|