Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@cliffeh
Copy link
Contributor

@cliffeh cliffeh commented Nov 18, 2024

This PR primarily does 2 things:

  1. Makes the backend server expose CRUD operations (mostly - "Update" is still unimplemented) in a more REST-ful way, and
  2. Makes the frontend Javascript responsible for the rendering and search functionality

It adds a new /notes endpoint that returns JSON payloads of Vec<Note>, and uses the indices within that Vec to be able to directly address individual notes. This has a handful of upshots:

  • Both the server and the frontend Javascript now maintain the same state ordering of Notes. For example, the frontend is responsible for putting the notes into reverse chronological order at display time (which opens a path for user-selectable sorting).
  • ...which means that order within the Vec<Note> now matters (which I think is fine, but is something to be aware of).
  • Any change to any Note now requires refreshing all Notes...which I also think is fine for the common use case, but could be optimized as a future enhancement (I have a couple of ideas on this).
  • Paves the way fairly easily implementing Update/Edit functionality (unimplemented at present).
  • Paves the way for an individual-note display mode (unimplemented, but should be easy to implement).

@freetonik
Copy link
Owner

Awesome, thanks! I'll take a closer look later this week.
I'm also thinking of embedding an instance of Codemirror or EasyMDE for some nicer Markdown typing experience. With your changes, + update/edit, + a nicer editor maybe we could release version 1.0 soon!

@freetonik freetonik merged commit c11dd08 into freetonik:main Dec 4, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants