lukejacksonn / lukejacksonn/servor

[Feature Request] Allow multiple roots

Open
#74 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.1k
Forks
68
PR merge metrics
No merged PRs in 30d

Description

Consider the following project tree:
```
project-root
├ src
│ └ main.js
└ static
└ index.html
```
Currently, for `index.html` be able to link to `main.js`, servor must run in the `project-root` folder and the script tag in html must be ``
```shell
$ cd ~/project-root
$ servor .
```

It would be really useful to allow servor to serve more folders than just the root. Something like:
```shell
$ cd ~/project-root
$ servor ./static --extern ./src
```
This would serve the `./src` folder as if it and `./static` were the same.
So the `index.html` would link the script at same level (`<script src="./main.js">`)

The `--extern` param could be repeatable to allow multiple entrypoints
```shell
$ cd ~/project-root
$ servor ./static --extern ./src --extern ./libs
```
Duplicate paths (e.g.: `./static/style.css`, `./src/style.css` and `./libs/style.css`) could be served in order (left-to-right), returning the first found path.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the `servor ./static` CLI entry point and how requested paths are resolved and served. Check how repeated `--extern` arguments could be parsed and how duplicate paths should be searched left-to-right. Done means static and external folders share URL paths, with the first matching file returned.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.