Skip to content
Snippets Groups Projects
Commit dab7ad6a authored by Vytor Calixto's avatar Vytor Calixto :space_invader:
Browse files

(re)Add apicache

Cache lasts for a day
parent 22a79ace
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,9 @@ const cors = require('cors'); ...@@ -6,6 +6,9 @@ const cors = require('cors');
const log = require('./log')(module); const log = require('./log')(module);
const config = require('./config');
const cache = require('apicache').options({ debug: config.get('debug') }).middleware;
const app = express(); const app = express();
const api = require('./routes/api'); const api = require('./routes/api');
...@@ -15,6 +18,7 @@ app.use(bodyParser.urlencoded({ extended: false })); ...@@ -15,6 +18,7 @@ app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser()); app.use(cookieParser());
app.use(cors()); app.use(cors());
app.use(methodOverride()); app.use(methodOverride());
app.use(cache('1 day'));
app.use(api); app.use(api);
// catch 404 and forward to error handler // catch 404 and forward to error handler
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment