mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-26 02:35:25 +02:00
Ensure that all API calls and static resources are in their own unique paths. This makes it easier to add a load balancer on top of everything.
This commit is contained in:
@@ -39,13 +39,13 @@ module.exports = function(options) {
|
||||
|
||||
if (options.disableWatch) {
|
||||
app.use(compression())
|
||||
app.use('/static/build/entry',
|
||||
app.use('/static/app/build/entry',
|
||||
serveStatic(pathutil.resource('build/entry')))
|
||||
app.use('/static/build', serveStatic(pathutil.resource('build'), {
|
||||
maxAge: '10d'
|
||||
}))
|
||||
} else {
|
||||
app.use('/static/build', webpack({
|
||||
app.use('/static/app/build', webpack({
|
||||
debug: true
|
||||
, devtool: 'eval'
|
||||
, stats: {
|
||||
@@ -64,11 +64,11 @@ module.exports = function(options) {
|
||||
serveStatic(pathutil.resource('bower_components/stf-site/manual/advanced')))
|
||||
app.use('/v2-features',
|
||||
serveStatic(pathutil.resource('bower_components/stf-site/v2-features')))
|
||||
app.use('/static/data', serveStatic(pathutil.resource('data')))
|
||||
app.use('/static/status', serveStatic(pathutil.resource('common/status')))
|
||||
app.use('/static/browsers', browserIconMiddleware())
|
||||
app.use('/static/devices', deviceIconMiddleware())
|
||||
app.use('/static', serveStatic(pathutil.resource('app')))
|
||||
app.use('/static/app/data', serveStatic(pathutil.resource('data')))
|
||||
app.use('/static/app/status', serveStatic(pathutil.resource('common/status')))
|
||||
app.use('/static/app/browsers', browserIconMiddleware())
|
||||
app.use('/static/app/devices', deviceIconMiddleware())
|
||||
app.use('/static/app', serveStatic(pathutil.resource('app')))
|
||||
|
||||
app.use(serveFavicon(pathutil.resource(
|
||||
'bower_components/stf-graphics/logo/exports/STF-128.png')))
|
||||
@@ -119,14 +119,14 @@ module.exports = function(options) {
|
||||
})
|
||||
})
|
||||
|
||||
app.get('/api/v1/user', function(req, res) {
|
||||
app.get('/api/v1/app/user', function(req, res) {
|
||||
res.json({
|
||||
success: true
|
||||
, user: req.user
|
||||
})
|
||||
})
|
||||
|
||||
app.get('/api/v1/group', function(req, res) {
|
||||
app.get('/api/v1/app/group', function(req, res) {
|
||||
dbapi.loadGroup(req.user.email)
|
||||
.then(function(cursor) {
|
||||
return Promise.promisify(cursor.toArray, cursor)()
|
||||
@@ -148,7 +148,7 @@ module.exports = function(options) {
|
||||
})
|
||||
})
|
||||
|
||||
app.get('/api/v1/devices', function(req, res) {
|
||||
app.get('/api/v1/app/devices', function(req, res) {
|
||||
dbapi.loadDevices()
|
||||
.then(function(cursor) {
|
||||
return Promise.promisify(cursor.toArray, cursor)()
|
||||
@@ -171,7 +171,7 @@ module.exports = function(options) {
|
||||
})
|
||||
})
|
||||
|
||||
app.get('/api/v1/devices/:serial', function(req, res) {
|
||||
app.get('/api/v1/app/devices/:serial', function(req, res) {
|
||||
dbapi.loadDevice(req.params.serial)
|
||||
.then(function(device) {
|
||||
if (device) {
|
||||
|
||||
Reference in New Issue
Block a user