Skip to content

Fix wrong routes when passing a path as an argument #30

@Angelmmiguel

Description

@Angelmmiguel

From #3 and #29

When passing a path to wws (like wws ./examples), it should load the files starting from that route and assign the HTTP endpoint from it too. Currently, this is not the case and running wws ./examples when ./examples/handler.js exists will assign the /examples/handler route instead of the desired /handler.

The issue is located at:

let parsed_path: String = api_path

Here we are removing base_path from api_path, but in this case the string doesn't match properly:

api_path: examples/handler.js
base_path: ./examples/

In addition to that, in #3 @assambar described an issue when the folder does not include the trailing /. The trailing slash should be optional, so we need to fix that issue too.

Metadata

Metadata

Assignees

Labels

🐛 bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions