mirror of
https://github.com/linka-cloud/grpc.git
synced 2025-06-22 09:12:28 +00:00
service: add react web app serving option
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
@ -133,6 +133,9 @@ func newService(opts ...Option) (*service, error) {
|
||||
if err := s.gateway(s.opts.gatewayOpts...); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := s.reactApp(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// we do not configure grpc web here as the grpc handlers are not yet registered
|
||||
return s, nil
|
||||
}
|
||||
@ -203,7 +206,7 @@ func (s *service) run() error {
|
||||
hServer := &http.Server{
|
||||
Handler: alice.New(s.opts.middlewares...).Then(cors.New(s.opts.cors).Handler(s.opts.mux)),
|
||||
}
|
||||
if s.opts.Gateway() || s.opts.grpcWeb {
|
||||
if s.opts.Gateway() || s.opts.grpcWeb || s.opts.hasReactUI {
|
||||
go func() {
|
||||
errs <- hServer.Serve(hList)
|
||||
hServer.Shutdown(s.opts.ctx)
|
||||
|
Reference in New Issue
Block a user