com-lihaoyi / cask

Cask: a Scala HTTP micro-framework. Cask makes it easy to set up a website, backend server, or REST API using Scala
https://com-lihaoyi.github.io/cask/
Other
527 stars 55 forks source link

example project returns "/" as document not HTML #53

Closed yatesco closed 2 years ago

yatesco commented 3 years ago

Hi - I downloaded the example "TodoMVC Full Stack Web" example project following the link (https://github.com/lihaoyi/cask/releases/download/0.7.8/todo-0.7.8.zip) from https://com-lihaoyi.github.io/cask/#todomvc-api-server and then ran ./mill app.run.

Visiting http://localhost:8080 gives:

image image

I'm just reading the docs so I don't really know how to fix it, hence no PR.

Thanks!

Quafadas commented 3 years ago

It's not super well documented. This sets the mime type for javascript. Am guessing you'd need to set mime type for the html

https://github.com/OpenResult/caskscalajs/blob/master/server/src/Server.scala

mjhopkins commented 3 years ago

@Quafadas That's only relevant for static files. The issue seems to be that TypedTag is supposed to set the content type

override def httpContentType = Some("text/html")

but this doesn't work and instead you always get text/plain.

lihaoyi commented 2 years ago

Should be fixed by https://github.com/com-lihaoyi/cask/commit/c9ee4bb0da6fa25bf2e27955534da94b3bee170c

yatesco commented 2 years ago

thanks @lihaoyi