web
web copied to clipboard
How to add a REST API?
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.
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