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

Cobra CLI -> web server #2190

Closed
ashishb opened this issue Sep 14, 2024 · 2 comments
Closed

Cobra CLI -> web server #2190

ashishb opened this issue Sep 14, 2024 · 2 comments

Comments

@ashishb
Copy link

ashishb commented Sep 14, 2024

Is there a recommended way to build an app using Cobra CLI that can be used both as a web server as well as a CLI?

I am, primarily, looking for auto-converting CLI commands to URLs

@yashisrani
Copy link

@ashishb I think you can build app using Cobra CLI that can be used as web server also.

  • create cli commands using cobra cli
  • then use web framework like Gin/Gorilla Mux/Fiber/Echo for web server.
  • after that, map cli commands to http endpoints by defining handlers.
  • then use flag to switch between cli and web server.

This is my perspective to encounter this issue.

@ashishb
Copy link
Author

ashishb commented Jan 16, 2025

Thanks @yashisrani I was looking for something automated for after that, map cli commands to http endpoints by defining handlers.

@ashishb ashishb closed this as completed Jan 16, 2025
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

2 participants