-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
42 lines (33 loc) · 840 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"context"
"fmt"
"time"
"github.com/aws/aws-lambda-go/lambda"
log "github.com/sirupsen/logrus"
"github.com/Aibier/twitter-scrapy/controllers"
)
// HandleRequest ...
func HandleRequest(ctx context.Context, name App) (string, error) {
log.SetFormatter(&log.JSONFormatter{})
log.WithFields(
log.Fields{
"AppName": "twitter Migration",
"AppVersion": "v1",
}).Info("Starting the app...")
controllers.Sync()
log.Printf("At the end of my job, let's rest now! Completed time %s", time.Now().Local().String())
return fmt.Sprintf("Resources are saved %s by!", name.Name), nil
}
// App - the struct which contains information about our app
type App struct {
Name string
Version string
}
// start server
func (app *App) start() error {
return nil
}
func main() {
lambda.Start(HandleRequest)
}