-
Notifications
You must be signed in to change notification settings - Fork 926
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
feat, introduce an API Server to run commands through HTTP server #7056
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
davidfirst
changed the title
feat, introduce API Server to run commands through HTTP server
feat, introduce an API Server to run commands through HTTP server
Feb 17, 2023
GiladShoham
approved these changes
Feb 17, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To start the server, run
bit server
, which creates a new express server locally on port 3000.To run a command on this server, make a POST request to
/api/cli/:cmd
. Optionally, in the body, add the args and the flags of the command. For example:http://localhost:3000/api/cli/list
The result is a JSON object with the same output you would get when running the command with
--json
flag.If the command doesn't accept
json
flag, it'll throw a descriptive error about it.The main goal of this server is to provide a fast way to communicate with bit (e.g. vscode extension makes requests to bit). Because the server is running constantly, there is no bootstrap penalty we have in the CLI. Also, once the components are loaded in-memory, they're accessible immediately at no cost.
It runs a "watcher" in the background to make sure to update/clean the memory cache when needed.