moroshko / rxviz

Rx Visualizer - Animated playground for Rx Observables

Home Page:https://rxviz.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to use json-server for persisting snippets

ghuser opened this issue · comments

I cloned and run the service on port:3000.
I saw that it tries to save the snippets on port 4000, so I started a json-server with a default db {snippets:[]}.

Snippets entries are created with id 1,2,3... but the code is not present.
I also see this when clicking on visualize which might be related to not being able to save the code:

Warning: Failed prop type: Invalid prop `shareId` of type `number` supplied to `_class`, expected `string`.
    in _class (at index.js?entry:182)
    in _class (created by Container)
    in AppContainer (created by Container)
    in Container (created by App)
    in div (created by App)
    in App

Current entries on http://localhost:4000/snippets/

[
  {
    "isShared": true,
    "id": 1
  },
  {
    "isShared": true,
    "id": 2
  },
  {
    "isShared": true,
    "id": 3
  }
]

Would be nice to fix this or propose any other back-end for snippets.

FYI: As a workaround I tried to run json-server with shareId as identifier:
json-server -p4000 -w db.json -i shareId
In this case, every new snippet is saved on the server when I press visualize.
For some reason I cannot see the share link button, but if I manually get the newly created shareId then I can visualize correctly (e.g. on http://localhost:3000/v/4 )