Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you use the same controller code for both the front-end and the back-end you can (along with, eg, browser-express and express and parallel GraphQL middleware for each execution context) use form posts for the HTML requests along with fetch for the SPA "requests".

This also means that your application will work the same with JS disabled as it does with JS enabled.

Here's a somewhat convoluted explanation of the general approach: https://fex-template.fly.dev - it happens to use F# with the Fable compiler but it should be somewhat legible to most developers!



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: