Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import router from "./router";
import config from "./config/init";
import rest from "./rest";
import {clone} from "lodash";
const app = koa();
const env = process.env.NODE_ENV || "development";
// const appRouter = koaRouter();
app.use(responseTime());
app.use(logger());
// various security headers
app.use(helmet.defaults());
if (env === "production") {
app.use(require("koa-conditional-get")());
app.use(require("koa-etag")());
app.use(require("koa-compressor")());
// Cache pages
const cache = require("lru-cache")({maxAge: 3000});
app.use(require("koa-cash")({
get: function*(key) {
return cache.get(key);
},
set: function*(key, value) {
cache.set(key, value);
}