-
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.
Replies: 2 comments 6 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.
-
@RSelwa did you ever get this working on the server? |
Beta Was this translation helpful? Give feedback.
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