move server to Siad, start siad server immediately, properly close all modules.
This PR moves api.Server to the siad
binary. package api
has been changed to export an API
type, which fulfills the http.Handler
interface. Server
in siad serves this handler, along with its own handler which controls siad
(/daemon
routes). This PR fixes https://github.com/NebulousLabs/Sia/issues/1399, as it does a deferred close for each module. It also opens the door for 'instant' server startup; future PRs can build off of this one and provide module loading statuses to API callers.
Fixes #1399 (closed)