web icon indicating copy to clipboard operation
web copied to clipboard

How to add a REST API?

Open Alex-Jongman opened this issue 2 years ago • 1 comments

I'm more focused on the client side, but for demoing/the experience I need to have a simple server that offers a REST API to my frontend. I wonder if it is possible (and in case it is, how to do it?) to add code to modernweb-dev to get a REST API at the server side. Can't find any info about it in the Docs/Guides.

Alex-Jongman avatar Mar 23 '22 23:03 Alex-Jongman

You can proxy to a REST service: https://modern-web.dev/guides/dev-server/proxy-to-other-servers/

Or you can implement a service in a serve hook: https://modern-web.dev/docs/dev-server/writing-plugins/hooks/#hook-serve

rhashimoto avatar Apr 17 '22 17:04 rhashimoto