Can't Have Hyphenated Route Names
Closed this issue · 2 comments
davood-n commented
I am running BunRest on Bun v0.1.13, and there seems to be an issue with the route names containing hyphens. All routes paths that start with the word before the hyphen and onwards on the hyphenated route will resolve to the hyphenated endpoint. Ex. if the '/api' route is requested, "hello world" with a status of 200 will be the response. The same for '/api-
', '/api-e
', '/api-en...
', and '/api-endpoint-any-other-text-after_doesntneedtobehyphenated
'.
Code to reproduce this error:
import server from "bunrest";
const app = server();
app.get('/api-endpoint', (request, response) => {
response.status(200).json({message:"hello world!"});
});
app.get('/api', (request, response) => {
response.status(500).json({message: "error!"});
});
app.listen(4000, () => {
console.log('App is listening on port 3000');
});
console output:
[davidn000@linux]$ bun buntest.js
App is listening on port 3000