raharrison/kotlin-ktor-exposed-starter

Can not start app with ./gradlew run

tuhlmann opened this issue · 4 comments

Hey @raharrison ,

this is probably a question only a total Kotlin newbie can ask- I do it anyway :)
I'm looking at different ktor example projects to learn its structure, and while I can start most of them with ./gradlew run it seems I can't start yours. Can you let me know what I'm doing wrong?
I tried to find some explanation in the README. So once I get it to run I'm happy to provide a PR against your README (in case I didn't just miss the explanation).

My assumption is that I can run the service somehow- is run the correct command?

Here's what's going wrong:

tuhlmann:~/.../kotlin/kotlin-ktor-exposed-starter$ ./gradlew run
> Task :run FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':run'.
> No main class specified and classpath is not an executable jar.

Thanks,
Torsten.

Yes you're right, thanks for pointing this out. Have added missing config to Gradle file - can you try again with the latest version?

@raharrison Thank you so much for the quick response!

It's working now in this latest version.

There's one tiny thing that probably puts of other newcomers: When running the app with ./gradlew run at some point its output says the server is listening to 0.0.0.0:8080. But because there's no root route, going to localhost:8080 in the browser just gives back an error. A user might think now he's done something wrong etc.

Maybe a good addition would be a very simple index route that just lists the possible routes to get all widgets, or get a single one.

For my purposes the repo now works perfect- thank you!

Fair point - have added a simple index page.

Working great- thank you!