Package Exports
- tsx-serve
Readme
tsx-serve
tsx-serve is a lightweight, TypeScript-based static file server CLI built on top of Express.js. It allows you to quickly serve static files from any directory with customizable options, making it perfect for local development, file sharing, or simple hosting solutions.
Has built-in tunneling support with custom sub-domains for easy sharing of your local server through the internet by simply using command arguments.
Features
- 📦 Simple CLI to serve static files.
- 🌍 Tunneling support for sharing your local server through the internet, allowing custom sub-domains.
- 🌐 Express.js under the hood, offering robust and scalable serving.
- 🚀 Lightweight and easy to use for quick development setups or file sharing.
Installation
To use tsx-serve, first install it globally using npm:
npm i -g tsx-serveOr with yarn:
yarn global add tsx-serveWithout installing globally, you can also use npx to run the CLI:
npx tsx-serve ./publicOr with yarn:
yarn tsx-serve ./publicUsage
Once installed, you can serve static files by specifying the directory/file path:
tsx-serve ./publicAvailable CLI Options
--portor-p: Specify the port number (default: 3000).--tunnelor-t: Enable tunneling support for sharing your local server through the internet.--subdomainor-s: Specify a custom sub-domain for the tunnel URL.--helpor-h: Show the usage guide.
Example
Serve files from the ./dist directory on port 4000:
tsx-serve -p 4000 ./distAccess your files via http://localhost:4000.
More Examples
Serve files from the current directory on port
8080using Pinggy as tunneler:tsx-serve -p 8080 -t pg .
Serve files from the
./publicdirectory with a custom sub-domain using Localtunnel as tunneler:tsx-serve -t lt -s my-server ./public
Development
If you want to modify or contribute to this project, follow these steps:
Clone the repository:
git clone https://github.com/byomess/tsx-serve.gitInstall dependencies:
npm install
Build the project:
npm run buildLink the CLI for local development:
npm link
Contributing
Contributions are welcome! Feel free to open issues or submit pull requests on the GitHub repository.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
### Key Sections:
- **Features**: Highlights the simplicity and purpose of the tool.
- **Installation & Usage**: Clear instructions on how to install and use it.
- **Development**: Steps for contributing to the project.
- **Contributing & License**: Basic information for open-source collaboration.
Feel free to customize the `GitHub` URL and any other specific details to match your project!