Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pubudu91/file-server


https://github.com/pubudu91/file-server

Last synced: 6 days ago
JSON representation

Awesome Lists containing this project

README

        

# Ballerina File Server
This is a sample file server written in Ballerina. The server can be run to serve files in a specified directory.

## Running the server
The program takes the directory to serve as an argument. This can be provided either through a config file, an environment variable or as a CLI param. If the directory is not specified, it will serve the current directory.
```
$ ballerina run -e root.dir=dir/to/be/served file_server
```
### Listing the files available
Returns a JSON object array which contains the names of the files available.
```
$ curl http://localhost:9090/files/v1/list
```
### Fetching a file
Returns the specified file. Returns a 404 error if the file could not be found.
```
$ curl http://localhost:9090/files/v1/file/
```