Skip to content

Commit

Permalink
Use server.js redirect instead of next.config.js
Browse files Browse the repository at this point in the history
  • Loading branch information
kasbah committed May 27, 2023
1 parent 2a6fc70 commit a273d82
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 0 additions & 5 deletions frontend/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ module.exports = async phase => {
destination: '/:user/:repo*',
permanent: true,
},
{
source: '/:user/:repo/:project/1-click-BOM.tsv',
destination: `${process.env.KITSPACE_ASSET_URL}/:user/:repo/HEAD/:project/1-click-BOM.tsv`,
permanent: false,
},
]
},
}
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ async function main() {
server.use(morgan('tiny'))
}

server.get('/:user/:repo/:project/1-click-BOM.tsv', (req, res) => {
const { user, repo, project } = req.params
return res.redirect(
307,
`${process.env.KITSPACE_ASSET_URL}/${user}/${repo}/HEAD/${project}/1-click-BOM.tsv`,
)
})

server.all('*', async (req, res, next) => {
req.session = await fetch('http://gitea:3000/user/kitspace/session', {
headers: { ...req.headers, accept: 'application/json' },
Expand Down

0 comments on commit a273d82

Please sign in to comment.