Skip to content

Ability to use json-server for persisting snippets #20

Description

@ghuser

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 )

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions