goup

module
v0.0.0-...-713cdd6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2020 License: MIT

README

Goup

Simple upload file to server with golang

Install

go get github.com/prongbang/goup

How to use

  • .env
HOST=http://localhost:4000/
EXT=jpg,jpeg,png,gif
  • main.go
package main

import (
	"github.com/labstack/echo"
	"github.com/prongbang/goup/pkg/file"
)

func main() {
	e := echo.New()

	e.Static("/public", "public")
	file.ProvideRoute().Initial(e)

	e.Logger.Fatal(e.Start(":4000"))
}

Run

make start

Endpoint

  • Request
POST http://localhost:4000/api/v1/upload

Fields:
- file=filename.jpg
  • Response
{
  "filePath": "http://localhost:4000/public/assets/images/BloC.png"
}

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL