-
Hello, we're wondering if signal work on server side for mocking server response. Do you know if it's possible ? We didn't find the response in the docs. Thanks in advance |
Beta Was this translation helpful? Give feedback.
Answered by
maxnowack
Nov 5, 2024
Replies: 1 comment 4 replies
-
In theory all of the code also works on server side. Make sure that you use a persistence adapter that doesn't have browser dependencies (local storage for instance). |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You don't have to use the localStorage adapter with the
SyncManager
. You can pass a function to create your own persistence adapter instances to the constructor (see https://signaldb.js.org/sync/reference/#parameters).On server side you could use the file system or also something like an in-memory adapter like we use in some unit tests:
https://github.com/maxnowack/signaldb/blob/main/packages/signaldb/__tests__/helpers/memoryPersistenceAdapter.ts