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

Programmatic API #86

Closed
leo opened this issue Jan 24, 2017 · 5 comments
Closed

Programmatic API #86

leo opened this issue Jan 24, 2017 · 5 comments

Comments

@leo
Copy link
Contributor

leo commented Jan 24, 2017

For loading serve inside an app

@leo leo added the minor label Jan 24, 2017
@timneutkens
Copy link
Member

That would be really cool 👍

@dar5hak
Copy link
Contributor

dar5hak commented Feb 15, 2017

Hi everyone. I want to work on this.

Going through the code, I see that when using the CLI, we determine the args and the directory by line 43 in bin/serve.js.

A high-level solution, I think, would be to extract the rest of the file into a function that accepts flags and directory as arguments. We could then just export that function as the API.

What are your thoughts on this?

@leo
Copy link
Contributor Author

leo commented Feb 15, 2017

@dar5hak Great idea! Maybe we can even keep the CLI like it is and just let the programmatic API run the CLI as a command using child_process.spawn or child_process.exec + setting the flags by setting process.argv. 🤔

@dar5hak
Copy link
Contributor

dar5hak commented Feb 16, 2017

@leo Oh yes! That would be simpler. I'll send a pull request tonight (UTC+0530).

Would you prefer an index.js at the project root, or inside lib/?

@leo
Copy link
Contributor Author

leo commented Feb 16, 2017

@dar5hak A file named api.js inside lib/... 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants