Skip to content

server for the Markus document network

License

Notifications You must be signed in to change notification settings

donuts-are-good/markserv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

markserv donuts-are-good's followers donuts-are-good's stars donuts-are-good's visitors

MarkServ

MarkServ is a lightweight, Markdown-focused server for the Markus document network. It's designed to be simple, performant, and compatible with any text files that use the Markdown syntax.

Installation

To install MarkServ, clone the repository and build the project:

git clone https://github.com/donuts-are-good/markserv.git
cd markserv
go build

Usage

MarkServ is configured through a config.json file, which should be located in the same directory as the executable. The configuration file should specify the server port, the location of the Markdown files, and the allowed file types. Here is an example configuration:

{
  "port": "88",
  "web": "/path/to/your/markdown/files",
  "allowedFileTypes": [".md", ".txt", ".markdown"]
}

Once the server is configured, it can be started with the following command:

./markserv

The server will then be accessible at http://localhost:88 (or whichever port was specified in the configuration).

Routing

The server works by responding to HTTP GET requests and returning the content of the corresponding Markdown file. The Markdown files should be organized in a directory structure that matches the URL structure. For example, a request to http://localhost:88/myfile.md would correspond to a file located at /path/to/your/markdown/files/myfile.md.

When a client requests a directory (like http://localhost:88/mydir/), the server will look for a file named index.md in that directory.

The server will respond with a 404 status code if the requested file does not exist, and a 400 status code if the request path contains an invalid file type or an attempt at a directory traversal attack.

Security

MarkServ is designed with basic security measures to prevent unauthorized access to the server's files. It checks for and denies requests containing "..", which could potentially be used for a directory traversal attack. It also restricts the types of files that can be served to those specified in the configuration.

However, as with any server software, it is advisable to run MarkServ in a secured environment and to keep it up-to-date with the latest security patches.

Contribution

If you find a bug, have a feature request, or want to contribute to the code, please feel free to open an issue or a pull request.

license

MIT License 2023 donuts-are-good, for more info see license.md