Skip to content

Commit

Permalink
fix(server): remove 'routes' path when setting filename for routes
Browse files Browse the repository at this point in the history
  • Loading branch information
leomp12 committed Feb 19, 2020
1 parent ae77d7e commit 119524c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ router.get('/', (req, res) => {
})

// base routes for E-Com Plus Store API
recursiveReadDir(path.join(__dirname, routes)).forEach(filepath => {
const routesDir = path.join(__dirname, routes)
recursiveReadDir(routesDir).forEach(filepath => {
// set filename eg.: '/ecom/auth-callback'
let filename = filepath.replace(__dirname, '').replace(/\.js$/i, '')
let filename = filepath.replace(routesDir, '').replace(/\.js$/i, '')
if (path.sep !== '/') {
filename = filename.split(path.sep).join('/')
}
Expand Down

0 comments on commit 119524c

Please sign in to comment.