Code Monkey home page Code Monkey logo

Comments (5)

unknwon avatar unknwon commented on May 13, 2024

你这样提问对解决问题毫无帮助,请提供更多代码、目录结构等信息后再重启issue

from macaron.

muei avatar muei commented on May 13, 2024

之前在群里提过,小黑说是设计如此。
我的意思是,静态文件夹(public)下的index.html,直接访问请求http://localhost:xxx/ 是无法访问的,http://localhost:xxx/index.html才可以访问。
我是想确认下是否本身设计如此,因为我用过很多其他的框架 比如martini,静态文件夹下的index文件是可以直接默认访问的,而且优先于注册的路由

from macaron.

unknwon avatar unknwon commented on May 13, 2024

我按照你说的测试了,没有出现你说的问题,是可以访问index.html的。

from macaron.

muei avatar muei commented on May 13, 2024

我的是win8.1 64位环境下。

package main

import (
    "github.com/Unknwon/macaron"
)

func main() {
    m := macaron.Classic()
    // m.Get("/", func() (int, string) {
    //  return 200, "helloworld"
    // })
    m.Run()
}

目录结构:
example
./public
./public/index.html
./main.go

运行程序go run main.go
浏览器访问http://localhost:4000/,报404

from macaron.

unknwon avatar unknwon commented on May 13, 2024

复制你的代码和目录结构,mac下还是没有问题。。我也用的go run。回头win下再测试下

from macaron.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.