@jb_fmanager/koa
v1.1.0
Published
jb file manager endpoint setup for koa
Downloads
2
Readme
npm i @jb_fmanager/koa @jb_fmanager/node-utils
yarn add @jb_fmanager/koa @jb_fmanager/node-utils
const Koa = require("koa");
const Router = require("koa-router");
const app = new Koa();
const koaStatic = require("koa-static");
const bodyParser = require("koa-bodyparser");
const cors = require("@koa/cors");
const router = new Router();
// passing the router as first argument
require("@jb_fmanager/koa")(router, {
root: "public",
prefix: "/api/fm",
errorHandler: undefined,
});
app.use(cors());
app.use(bodyParser());
app.use(router.routes());
app.use(koaStatic("./public"));
app.listen(4000, () => console.log("listening on port 4000"));