Skip to content

Commit

Permalink
Remove proxy /static in dev mode, static file needn't proxy for dev
Browse files Browse the repository at this point in the history
  • Loading branch information
nonumpa committed Nov 4, 2020
1 parent 3cb8a60 commit 6132c7f
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,23 @@ if (process.env.NODE_ENV === 'production') {
maxage: 31536000 * 1000, // https://stackoverflow.com/a/7071880/1582110
})
);
app.use(
serve({
rootDir: path.join(__dirname, '../static'),
rootPath: '/static',
maxage: 31536000 * 1000, // https://stackoverflow.com/a/7071880/1582110
})
);
} else {
app.use(
require('koa-proxies')('/liff', {
target: `http://localhost:${process.env.LIFF_DEV_PORT}`,
logs: true,
})
);
app.use(
require('koa-proxies')('/static', {
target: `http://localhost:${process.env.LIFF_DEV_PORT}`,
logs: true,
})
);
}

app.use(
serve({
rootDir: path.join(__dirname, '../static'),
rootPath: '/static',
maxage: 31536000 * 1000, // https://stackoverflow.com/a/7071880/1582110
})
);

app.use(router.routes());
app.use(graphqlMiddleware);
app.use(router.allowedMethods());
Expand Down

0 comments on commit 6132c7f

Please sign in to comment.