Skip to content

Commit ad7875a

Browse files
committed
Send static files without auth
1 parent 9798a45 commit ad7875a

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lib/index.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ var start = function(config) {
127127
next();
128128
}
129129
});
130+
131+
// Static files
132+
app.use('/', express.static(path.resolve(__dirname, '../build')));
133+
134+
// Auth
130135
app.use(function(req, res, next) {
131136
var doAuth = basicAuth(function(user, pass, fn){
132137
users.auth(user, pass)
@@ -139,14 +144,6 @@ var start = function(config) {
139144
if (req.session.userId || !config.auth.basic) return next();
140145
doAuth(req, res, next);
141146
});
142-
143-
// Static files
144-
app.use('/', express.static(path.resolve(__dirname, '../build')));
145-
app.use('/packages', _middleware(function() {
146-
return express.static(config.packages.root);
147-
}));
148-
149-
// Auth
150147
app.use(function(req, res, next) {
151148
if (req.user) {
152149
req.session.userId = req.user.id;
@@ -169,6 +166,11 @@ var start = function(config) {
169166
}
170167
});
171168

169+
// Download packages
170+
app.use('/packages', _middleware(function() {
171+
return express.static(config.packages.root);
172+
}));
173+
172174
// RPC services
173175
app.use('/rpc', rpc.router);
174176

0 commit comments

Comments
 (0)