How to add a REST API to the Modern Web Dev Server?

101 views Asked by At

I'm using the dev-server of Modern Web to build client side code. Now I want to add a small backend with a REST API, but I can't find any information of how to add a backend with a REST API to this server. Any hints on where to start?

1

There are 1 answers

0
Quentin On BEST ANSWER

You could write a plugin for it but I wouldn't recommend it.

It's a development server designed for testing client-side code.

It isn't designed to be a production server, and if you are going to write a REST API then you will, presumably, want it to be usable in a production environment.

Build your API with a tool designed for it (such as Express.js or Spring Boot) and use CORS to make it accessible to the server you use for client-side development.