simpleserver-tool 0.3.0

dotnet tool install --global simpleserver-tool --version 0.3.0                
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local simpleserver-tool --version 0.3.0                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=simpleserver-tool&version=0.3.0                
nuke :add-package simpleserver-tool --version 0.3.0                

SimpleServer

NuGet version (simpleserver-tool) Build app codecov

A simple server command line tool to run a static backend. Written in C#, cross platform.

It is cross platform, has around 30MB, and does not require .NET ou .NET Framework to run.

Running

Download the version to your OS (see bellow) and run it like this:

simpleserver [<path>] [options]

If you run it without arguments it will serve the current running directory (pwd/cwd), bound to all network interfaces (0.0.0.0) on port 8080 and without logging to stdout. These are all configurable and there are many other options.

option type default value description
-i, --index switch Use a default index file when a file is not found.
--interface <interface> string 0.0.0.0 Network interface (IP or hostname) to bind the server to.
-p, --port <port> u16 8080 Port to run the server at.
--index-name <index-name> string index.html Default index file name.
-v, --verbose switch Show verbose output.
-s, --simple-paths switch Use simple paths. Allows to serve 'file.html' as '/file'.
-l, --log-http switch Log http output to stdout.
-d, --directory-browsing switch Enable directory browsing.

You can see this options in the command line by typing simpleserver --help.

For example, to run an SPA, you would want to serve every static file and serve index.html for every requested route that was not matched to a file. Like this:

simpleserver -i

To change the file, you'd also supply another option:

simpleserver -i --index-name default.html

Incompatible options

You can't run directory browsing and index file at the same time. If you try, directory browsing will be disabled.

You can't run simple paths and directory browsing at the same time. If you try, simple paths will be disabled.

Running the framework dependent .dll

The framework dependent simpleserver.dll can be run where you already have the .NET Runtime installed. You'll need the .NET 6 runtime, and run it like this:

dotnet simpleserver.dll [<path>] [options]

You will need all the files that are in the .tgz, decompress it to a directory and run it from there.

Installing

Standalone binaries

Download an artifact from the latest release and add it to your path.

There are artifacts for Windows and Linux (x86, ARM and Musl). The Linux ones are are dynamic binaries, they can't run on distroless containers (FROM scratch).

  • simpleserver-linux-arm - Linux ARM
  • simpleserver-linux-musl-x64 - Linux x64 Musl (Alpine etc)
  • simpleserver-linux-x64 - Linux ARM
  • simpleserver.exe - Windows x64
  • simpleserver.tgz - Cross platform, framework dependent

The .pdb files are symbol files and are only needed for debugging, not running the application.

As a dotnet cli tool

This tool can be installed as a dotnet global tool, if you have the .NET Sdk installed. It is hosted on nuget.org as simpleserver-tool. Install with:

dotnet tool install --global simpleserver-tool

Completions

This is written with dotnet-suggest. You'll need the .NET Sdk to enable completions. The detailed steps are outlined at the command-line-api project.

It works everywhere the .NET Sdk works. The supported shells are detailed on the above document and include Bash, Zsh and PowerShell.

Contributing

Questions, comments, bug reports, and pull requests are all welcome. Submit them at the project on GitHub.

Bug reports that include steps-to-reproduce (including code) are the best. Even better, make them in the form of pull requests.

Author

Giovanni Bassi.

License

Licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
0.3.0 481 2/20/2022
0.1.22 436 2/19/2022
0.1.0 443 2/19/2022