how to access the firebase database emulator from the .net implementation of the realtime database

in #technology11 months ago

this is a follow up to my previous post wherein i solved the issue atleast partially using a caddy server and the config setup below

localhost {
#the route where you want the emulator to be accessed at (this is mainly important if you are already using caddy)
            route /db/* {
#this part is extremely important because it appends the project name to the url (this is the emulators way of doing https://<projectname> )
            rewrite /db/* ?{query}&ns=<projectname>
#strip away the path you decided on so that the rest of the url is passed to the emulator
            uri strip_prefix /db
#this line handles the special case where the library likes to add a / between the path and the .json extension
            uri replace /.json .json
#here is where you place the link to the emulator (I left the default value set when you setup a new project)
            reverse_proxy localhost:9000

This config works for single queries I have not figured out how to make it work with realtime observables yet.