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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.