Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pubudu91/file-server
https://github.com/pubudu91/file-server
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/pubudu91/file-server
- Owner: pubudu91
- License: apache-2.0
- Created: 2019-08-16T05:06:53.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-08-16T06:10:22.000Z (about 5 years ago)
- Last Synced: 2024-04-16T13:04:53.781Z (7 months ago)
- Language: Ballerina
- Size: 13.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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/
```