17 Sapper server routes
This chapter covers
- Server routes
- Server route source files
- Server route functions
- A create/retrieve/update/delete (CRUD) example
- Switching to Express
Server routes are Node-based API/REST services. Sapper supports implementing these, and it hosts them so the client-side code can send requests to them. It enables collocating server-side code with client-side code in the same project. This is convenient for full-stack developers because it avoids having to maintain multiple source code repositories, one for client-side code and one for server-side code. It also has the benefit of using the same programming language, JavaScript, for all of the code.
Note It is possible to host a Svelte app and Node-based API server in ...
Get Svelte and Sapper in Action now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.