Skip to content

Commit 13123cd

Browse files
author
Hans Kristian Flaatten
committed
fix(eslint): app is already declared in the upper scope
1 parent d19487b commit 13123cd

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

apps/admin/controller.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
const router = require('express').Router;
55
const each = require('async-each-map');
66

7-
const app = router();
7+
const route = router();
88
const ApiUser = require('../app/model').ApiUser;
99

1010
const filters = require('./filters');
@@ -16,24 +16,24 @@ if (module.parent.exports.nunjucks) {
1616
});
1717
}
1818

19-
app.use('/', (req, res, next) => {
19+
route.use('/', (req, res, next) => {
2020
if (!req.session.auth.isAdmin) {
2121
return res.redirect('/');
2222
}
2323

2424
return next();
2525
});
2626

27-
app.get('/', (req, res) => res.redirect('/admin/users'));
27+
route.get('/', (req, res) => res.redirect('/admin/users'));
2828

29-
app.get('/users', (req, res, next) => {
29+
route.get('/users', (req, res, next) => {
3030
ApiUser.find().limit(100).sort({ updated: -1 }).exec((err, apps) => {
3131
if (err) { return next(err); }
3232
return res.render('admin/users.html', { req, apps });
3333
});
3434
});
3535

36-
app.get('/limits', (req, res, next) => {
36+
route.get('/limits', (req, res, next) => {
3737
const error = req.session.message;
3838
delete req.session.message;
3939

@@ -54,7 +54,7 @@ app.get('/limits', (req, res, next) => {
5454
});
5555
});
5656

57-
app.post('/limits/:userId/:appId', (req, res, next) => {
57+
route.post('/limits/:userId/:appId', (req, res, next) => {
5858
ApiUser.findOne({ _id: req.params.userId }, (err, user) => {
5959
if (err) { return next(err); }
6060

@@ -114,7 +114,7 @@ app.post('/limits/:userId/:appId', (req, res, next) => {
114114
});
115115
});
116116

117-
app.get('/requests', (req, res, next) => {
117+
route.get('/requests', (req, res, next) => {
118118
const error = req.session.message;
119119
delete req.session.message;
120120

@@ -133,7 +133,7 @@ app.get('/requests', (req, res, next) => {
133133
});
134134
});
135135

136-
app.post('/requests/:userId/:appId', (req, res, next) => {
136+
route.post('/requests/:userId/:appId', (req, res, next) => {
137137
ApiUser.findOne({ _id: req.params.userId }, (err, user) => {
138138
if (err) { return next(err); }
139139

@@ -186,14 +186,14 @@ app.post('/requests/:userId/:appId', (req, res, next) => {
186186
});
187187
});
188188

189-
app.get('/email', (req, res) => {
189+
route.get('/email', (req, res) => {
190190
const error = req.session.message;
191191

192192
delete req.session.message;
193193
res.render('admin/email.html', { req });
194194
});
195195

196-
app.post('/email', (req, res, next) => {
196+
route.post('/email', (req, res, next) => {
197197
const from = req.body.from;
198198
const subject = req.body.subject;
199199
const template = req.body.content;
@@ -303,6 +303,6 @@ app.post('/email', (req, res, next) => {
303303
}
304304
});
305305

306-
app.get('*', (req, res) => res.redirect('/admin'));
306+
route.get('*', (req, res) => res.redirect('/admin'));
307307

308-
module.exports = app;
308+
module.exports = route;

0 commit comments

Comments
 (0)