Simple file store service
This is a simple Go HTTP server that provides endpoints for storing, listing, removing, updating, counting words, and finding frequent words in uploaded files.
- Clone this repository:
- Navigate to repository
- cd file-store
- Run the server.go
- go run server.go
- Add File POST /store/add
- Add one or more files to the server's storage. Each file should be sent as a multipart form data with the key "file". Files are stored in the uploads/ directory.
- List Files GET /store/ls
- List all files stored on the server.
- Remove File DELETE /store/rm?file=<file_name>
- Remove a file from the server's storage. Provide the filename as a query parameter.
- Update File PUT /store/update?file=<file_name>
- Update a file in the server's storage. Provide the filename as a query parameter and send the new file as multipart form data with the key "file".
- Word Count GET /store/wc
- Count the total number of words across all uploaded files.
- Frequent Words GET /store/freq-words?limit=&order=<asc|desc>
- List the most frequent words in uploaded files. You can specify the limit and order of the results.
- Add a file:
- ./store add file1.txt
- Update the file
- ./store update file1.txt
- list the files
- ./store ls
- Remove a file
- ./store rm file1.txt
- Count the total words in a file
- ./store wc
- Print the most frequent words
- ./store freq-words