Skip to content

serving static files are not working anymore #210

@rvdwijngaard

Description

@rvdwijngaard

since f251eea service static files are not working as expected.

package main

import "github.com/labstack/echo"

func main() {
    // Echo instance
    e := echo.New()

    // Routes
    e.Static("/apidocs/", "./api/current/")
    e.Get("/:machineid", func(c *echo.Context) error { return c.NoContent(200) })
    e.Get("/:machineid/:count", func(c *echo.Context) error { return c.NoContent(200) })

    // Start server
    e.Run(":8080")
}

my /api/current is a folder which contains swagger stuff. The code above works fine if I comment out the second Get route.

    e.Static("/apidocs/", "./api/current/")
    e.Get("/:machineid", func(c *echo.Context) error { return c.NoContent(200) })
    // e.Get("/:machineid/:count", func(c *echo.Context) error { return c.NoContent(200) })

A get on /apidocs/ returns the same html content for each request:
localhost:8080/apidocs
localhost:8080/apidocs/swagger-ui.js -> returns the content of index.html

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions