https://github.com/izaurio/pavo
Server-side upload service for jQuery-File-Upload written in Golang
https://github.com/izaurio/pavo
file-upload go golang jquery jquery-file-upload pavo
Last synced: 5 months ago
JSON representation
Server-side upload service for jQuery-File-Upload written in Golang
- Host: GitHub
- URL: https://github.com/izaurio/pavo
- Owner: izaurio
- License: mit
- Created: 2014-08-27T12:21:50.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2017-11-23T13:03:01.000Z (over 8 years ago)
- Last Synced: 2026-01-13T20:43:47.284Z (6 months ago)
- Topics: file-upload, go, golang, jquery, jquery-file-upload, pavo
- Language: Go
- Homepage:
- Size: 341 KB
- Stars: 79
- Watchers: 6
- Forks: 18
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pavo
Server-side upload service for [jQuery-File-Upload](https://github.com/blueimp/jQuery-File-Upload) written in Golang.
## Usage
Running from the console by using the command:
```sh
$ bin/pavo --host=localhost:9078 --storage=/path/to/root/storage
```
## Example
After build run application:
```sh
$ bin/pavo --storage=dummy/root_storage
```
Open example page in your browser:
```sh
open http://localhost:9073/example/jfu-basic.html
```
## Install
#### Install golang
[Install](https://golang.org/doc/install) Golang. Set the [GOPATH](http://golang.org/doc/code.html#GOPATH) environment variable. For example for MacOS:
```sh
brew install go
mkdir $HOME/go
# Add this line in your .zshrc or .bash_profile
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
```
#### Install a project based build tool
Installing, or upgrading [gb](http://getgb.io) is super simple (assuming you’ve already got Go installed)
```sh
go get github.com/constabulary/gb/...
```
#### Install application:
Clone a repository and build the project:
```sh
git clone git@github.com:kavkaz/pavo.git
cd pavo
gb build
```
#### Setup nginx
When used in a production environment it is recommended to use a web server nginx. Configure the web server is reduced to specifying a directory for distribution static, location for the files, and optional authentication.
```
server {
listen 80;
server_name pavo.local;
access_log /usr/local/var/log/nginx/pavo/access.log;
error_log /usr/local/var/log/nginx/pavo/error.log notice;
location /auth {
internal;
proxy_method GET;
proxy_set_header Content-Length "";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_request_body off;
proxy_pass http://localhost:3000/auth/url/in/your/app;
proxy_set_header X-Original-URI $request_uri;
client_max_body_size 0;
}
location /files {
auth_request /auth;
client_body_temp_path /tmp;
client_body_in_file_only on;
client_body_buffer_size 521K;
client_max_body_size 10G;
proxy_pass_request_headers on;
proxy_set_header X-FILE $request_body_file;
proxy_pass_request_body off;
proxy_set_header Content-Length 0;
proxy_pass http://127.0.0.1:9073;
}
location / {
root /Path/To/Root/Of/Storage;
}
}
```
These settings allow you to save the request body into a temporary file and pass on our application link to the file in the header `X-File`.
## License
[MIT license](http://www.opensource.org/licenses/MIT). Copyright (c) 2014 Zaur Abasmirzoev.