Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only root route is working locally #25

Open
AndreasLagoni opened this issue May 12, 2021 · 0 comments
Open

Only root route is working locally #25

AndreasLagoni opened this issue May 12, 2021 · 0 comments

Comments

@AndreasLagoni
Copy link

I got the following code

router.get('/', (req, res) => {
  res.status(200).send("/")
});

router.get('/another', (req, res) => res.json({
  route: req.originalUrl
}));

app.use(bodyParser.json());
app.use('/.netlify/functions/server', router); // path must route to lambda
app.use('/', (req, res) => res.sendFile(path.join(__dirname, '../index.html')));

module.exports = app;
module.exports.handler = serverless(app);

Locally it will always just return the / path og never /another

Any ideas why? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant