gofr-dev / gofr

An opinionated GoLang framework for accelerated microservice development. Built in support for databases and observability.
https://gofr.dev
Apache License 2.0
3.61k stars 241 forks source link

Fix AddStaticFiles method #1146

Closed Umang01-hash closed 3 weeks ago

Umang01-hash commented 1 month ago

Describe the bug The method AddStaticFiles is not wokring correctly.

If we try to run this code:

func main() {
    app := gofr.New()

    app.AddStaticFiles("", "./static")

    app.Run()
}

And have some files in our static directory , when trying to access the route http://localhost:9000/abc.jpeg we are getting route not registered.

To Reproduce Steps to reproduce the behavior, if applicable:

  1. The code is:
package main

import "gofr.dev/pkg/gofr"

func main() {
    app := gofr.New()

    app.AddStaticFiles("/", "./static")

    app.Run()
}
  1. The error is
{
    "error": {
        "message": "route not registered"
    }
} 

Expected behavior We should be able to successfully route it.

iv4n-ga6l commented 1 month ago

@Umang01-hash Interesting issue! Would like to try to fix it!

Umang01-hash commented 1 month ago

@IvanGael Thank you for your interest, but I have already raised a PR for the same. You can please check any other existing issues will assign that to you.