websocket icon indicating copy to clipboard operation
websocket copied to clipboard

Use embeds for home files in chat examples

Open eldondev opened this issue 1 year ago • 2 comments

Rather than serving up the html files directly from whatever directory the program is run in, embed the files in the binary.

What type of PR is this? (check all applicable)

  • [ ] Refactor
  • [ ] Feature
  • [ ] Bug Fix
  • [ ] Optimization
  • [X] Documentation Update
  • [ ] Go Version Update
  • [ ] Dependency Update

Description

Added/updated tests?

  • [X] No, and this is why: Just example code

Run verifications and test

  • [X] I don't see any makefiles?
  • [ ] make verify is passing
  • [ ] make test is passing

eldondev avatar Aug 18 '24 04:08 eldondev

IDK IDK. It's pretty common for web servers to serve files instead of embedding them in the binary. This IMO complicates the example without a practical benefit.

WofWca avatar Nov 16 '24 13:11 WofWca

Benefits of this change are:

  • the cd step for running the example can be deleted.
  • the example can be go installed.
  • the example will follow current best practices for accessing static assets.

ghost avatar Nov 28 '24 07:11 ghost