Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[www] Code refactoring for www.go #109

Closed
sndurkin opened this issue Nov 2, 2017 · 3 comments
Closed

[www] Code refactoring for www.go #109

sndurkin opened this issue Nov 2, 2017 · 3 comments

Comments

@sndurkin
Copy link
Contributor

sndurkin commented Nov 2, 2017

Refactor www.go and backend.go so that functions in backend.go are smaller and more cohesive and www.go handles the incoming commands and creates the outgoing replies.

@sndurkin sndurkin changed the title More www and backend refactoring [www] More www and backend refactoring Nov 2, 2017
@rgeraldes
Copy link
Contributor

rgeraldes commented Nov 12, 2017

  • routing: strict slash method just needs to be applied once to the main router vs apply to all the routes (doc: any subrouters created from that route inherit the original StrictSlash setting.)
  • routing: fullRoute := v1.PoliteiaWWWAPIRoute + route is not necessary as we can create a sub router based on a prefix.
  • it's not easy to figure out right away the entry point of the repo: remove www.go and separate the logic between main.go (server creation and startup) and server.go
  • add graceful shutdown for multiple web servers.
    (examples: https://gist.github.com/peterhellberg/38117e546c217960747aacf689af3dc2)
  • Replace print + os.Exit with log.Fatal (same thing)
  • replace go to in the for select with a tag before the for loop called for instance L and do a break L inside the select.
  • replace *sessions.FilesystemStore with the interface sessions.Store in the PoliteiaWWW struct.
  • name conventions, ex: userHttpCode should be userHTTPCode

@sndurkin
Copy link
Contributor Author

@rgeraldes I like these cleanup ideas, although I'm not sure what you're referring to with the last one.

@marcopeereboom what do you think?

@sndurkin sndurkin changed the title [www] More www and backend refactoring [www] Code refactoring for www.go Nov 16, 2017
@marcopeereboom
Copy link
Member

I think this has taken too long.

vibros68 pushed a commit to vibros68/politeia that referenced this issue Aug 17, 2021
vibros68 pushed a commit to vibros68/politeia that referenced this issue Aug 17, 2021
* Update index.html

* Update SidebarText.js
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

No branches or pull requests

3 participants