Typed web-server

Is there a typed Racket version of all the Racket web-server stuff?

More than a month has passed, and I have found no evidence to the contrary, so I'm going to assume there is no typed Racket API to the web-server.

Now I'm not familiar with the process of grafting a typed API around an existing untyped implementation.
Can anyone enlighten me about the practical coding techniques that would have to be used for this?

I'm presuming this would be done by specially type-assigning imports or similar type-assigning provides.
Would there be a need for different module names for the typed and untyped versions of a module?
(I really know very little about interfacing between the typed and untyped dialects).

-- hendrik

I have been writing a typed racket application, and just grafted an untyped webserver onto it. It turned out to be performant to render the HTML using untyped code as well. Interactions between typed and untyped code can be expensive.

I found the easiest way to do it is to separate the typed and untyped code into separate modules. Typed code can be required into untyped modules with no changes. The other way around is slightly more tricky and needs require/typed.

https://docs.racket-lang.org/ts-guide/typed-untyped-interaction.html

I'm not familiar with the Racket web-server or Typed Racket, so I'm not sure if this is complete or only partial typed bindings.

1 Like

You render the HTML in untyped code. Do you build the HTML explicitly? I never build HTML myself. I use x-expressions and let the webserver itself turn it into HTML.

Thank you. I had searched for such a package myself and failed to find it. I've looked at it, and it seems to be the right kind of thing, but I don't know if it's complete either. I will have to try it out and see.

In general, I've had trouble finding packages online. I've even had trouble finding documentation for packages online -- even finding again documentation I've already seen before. To this end I've started putting links to documentation I've used in comments in the code where I use packages. You can often find recent copies of my code and very rough draft of its internal documentation at http://topoi.pooq.com/hendrik/maze-source/ .

(I'm busy with an other project, so updates will be sparse during November.)

-- hendrik

I used html-template in an untyped module and served it using response/output.

I found this much faster than constructing x-expressions in typed racket and having the untyped server serialize them.

It looks like typed/web-server/http provides enough of the types and structs that you can require/typed plenty of what you need to make a typed webserver.