Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to serve static files #19

Closed
divanvisagie opened this issue Aug 1, 2017 · 1 comment
Closed

Unable to serve static files #19

divanvisagie opened this issue Aug 1, 2017 · 1 comment

Comments

@divanvisagie
Copy link

I'm trying out spark with Kotlin for the first time so forgive me if this is a trivial error but it seems to be in line with the documentation. I have created a folder in src/main/resources/public that contains an index.html

package com.divanvisagie.todo
import spark.kotlin.*


fun main(args: Array<String>) {

    val http: Http = ignite()

    staticFiles.location("/public")

    http.get("/hello") {
        "Hello Spark Kotlin!"
    }


    println("Hello Kotlin ?")
}

However browsing to the following url returns a 404.

http://localhost:4567/index.html

@divanvisagie
Copy link
Author

Turns out not using the ignite solves the problem

package com.divanvisagie.todo

import spark.kotlin.*

fun main(args: Array<String>) {

    staticFiles.location("/public")

    get("/hello") {
        "Hello Spark Kotlin!"
    }


}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant