gabrielcsapo / node-git-server

🎡 A configurable git server written in Node.js
https://gabrielcsapo.github.io/node-git-server
MIT License
253 stars 73 forks source link

return promise from close method if callback method not specified #46

Closed mojavelinux closed 5 years ago

mojavelinux commented 5 years ago

resolves #45

gabrielcsapo commented 5 years ago

Awesome! @mojavelinux would you mind making close return a promise? so we can just do:

await server.close()
mojavelinux commented 5 years ago

Sure thing!

mojavelinux commented 5 years ago

I changed it so that if no callback is specified, the method returns a promise.

gabrielcsapo commented 5 years ago

@mojavelinux it seems like extra work to support both methods, would be able to just to keep it to returning a promise?

mojavelinux commented 5 years ago

Sure, I suppose. I guess that's more of a question for you. Is the goal to mimic the API of the HTTP server or simply provide a way to close the server? If the goal is just to provide a way to close the server, then we can change it to just return a promise (even though that differs from the listen API). I was just trying to be consistent.

mojavelinux commented 5 years ago

Done!

gabrielcsapo commented 5 years ago

thanks!