mv app's logic to service

pull/196/head
Michael Li 2 years ago
parent 3c14ced542
commit 0eda77775f

@ -1,29 +0,0 @@
package app
import (
"net/http"
"github.com/rocboss/paopao-ce/internal/conf"
"github.com/rocboss/paopao-ce/internal/servants"
)
type Service interface {
Start()
Stop()
Info() string
}
func NewWebService() Service {
e := newWebEngine()
servants.RegisterWebServants(e)
return &webService{
server: &http.Server{
Addr: conf.ServerSetting.HttpIp + ":" + conf.ServerSetting.HttpPort,
Handler: e,
ReadTimeout: conf.ServerSetting.ReadTimeout,
WriteTimeout: conf.ServerSetting.WriteTimeout,
MaxHeaderBytes: 1 << 20,
},
}
}

@ -1,10 +1,13 @@
package service
import (
"net/http"
"github.com/rocboss/paopao-ce/internal/conf"
"github.com/rocboss/paopao-ce/internal/core"
"github.com/rocboss/paopao-ce/internal/dao"
"github.com/rocboss/paopao-ce/internal/model"
"github.com/rocboss/paopao-ce/internal/servants"
"github.com/sirupsen/logrus"
)
@ -15,6 +18,27 @@ var (
DisablePhoneVerify bool
)
type Service interface {
Start()
Stop()
Info() string
}
func NewWebService() Service {
e := newWebEngine()
servants.RegisterWebServants(e)
return &webService{
server: &http.Server{
Addr: conf.ServerSetting.HttpIp + ":" + conf.ServerSetting.HttpPort,
Handler: e,
ReadTimeout: conf.ServerSetting.ReadTimeout,
WriteTimeout: conf.ServerSetting.WriteTimeout,
MaxHeaderBytes: 1 << 20,
},
}
}
func Initialize() {
ds = dao.DataService()
ts = dao.TweetSearchService()

@ -1,4 +1,4 @@
package app
package service
import (
"context"
Loading…
Cancel
Save