This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package crawler | |
import ( | |
"fmt" | |
"time" | |
"github.com/gocolly/colly" | |
) | |
// SecretMag <struct> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package models | |
// News <model> | |
// is used to describe article model. | |
type News struct { | |
ID string `json:"_id" bson:"_id"` | |
Title string `json:"title" bson:"title"` | |
Preamble string `json:"preamble" bson:"preamble"` | |
TimeAdded int64 `json:"time_added" bson:"time_added"` | |
Link string `json:"link" bson:"link"` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
) | |
func main() { | |
server.Init() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package crawler | |
import ( | |
"time" | |
) | |
// NewsCrawler <interface> | |
// is used to describe news crawler class instance | |
type NewsCrawler interface { | |
Run() []models.News |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controllers | |
import ( | |
"github.com/gin-gonic/gin" | |
) | |
// NewsController <controller> | |
// is used for describing controller actions for news. | |
type NewsController struct{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package server | |
import ( | |
"github.com/gin-contrib/cors" | |
"github.com/gin-gonic/gin" | |
) | |
// NewRouter <function> | |
// is used to create a GIN engine instance where all controller and routes will be placed | |
func NewRouter() *gin.Engine { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package server | |
import ( | |
) | |
// Init <function> | |
// is used to initialize server and all the corresponding services such as DB, Utils, Workers | |
func Init() { | |
// utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package utils | |
import ( | |
"log" | |
"github.com/kelseyhightower/envconfig" | |
) | |
// EnvVariables <struct> | |
// is used to descrive environment variables structure of a project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
fmt.Println("Good news!") | |
} |