Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

db接続しないapi #35

Open
shari-sushi opened this issue Jan 26, 2024 · 2 comments
Open

db接続しないapi #35

shari-sushi opened this issue Jan 26, 2024 · 2 comments

Comments

@shari-sushi
Copy link
Owner

ポートフォリオにてAWSでデプロイを試みている。
app-api間の接続(疎通?)を確認したいが、現状ではapi-dbの接続ができない場合はapiが起動しない。
db接続不要なapiを作成する。

shari-sushi added a commit that referenced this issue Jan 26, 2024
shari-sushi added a commit that referenced this issue Jan 26, 2024
@shari-sushi
Copy link
Owner Author

shari-sushi commented Jan 26, 2024

func ReturnAlterTopPage(c *gin.Context) {
    var errs []error
    var allVts []domain.Vtuber
    var VtsMosWithFav []domain.TransmitMovie
    var VtsMosKasWithFav []domain.TransmitKaraoke

    allVts = []domain.Vtuber{
        {
            VtuberId:         1,
            VtuberName:       "接続確認",
            VtuberKana:       "sucsessefuly_connect",
            IntroMovieUrl:    "",
            VtuberInputterId: 1,
        },
    }

    VtsMosWithFav = []domain.TransmitMovie{
        {
            VtuberId: 1,
            MovieUrl: "www.youtube.com/watch?v=4p1pIYBU61c",
            Vtuber: domain.Vtuber{
                VtuberName:       "接続確認",
                VtuberKana:       "sucsessefuly_connect",
                IntroMovieUrl:    "",
                VtuberInputterId: 1,
            },
            Movie: domain.Movie{
                MovieTitle:      "牙アピールかわいいおいも[新人vTuber妹望おいも]",
                VtuberId:        1,
                MovieInputterId: 1,
            },
            Count: 100,
            IsFav: false,
        },
    }

    c.JSON(http.StatusOK, gin.H{
        "vtubers":                 allVts,
        "vtubers_movies":          VtsMosWithFav,
        "vtubers_movies_karaokes": VtsMosKasWithFav,
        "error":                   errs,
        "message":                 "dont you Loged in ?",
    })
    return

}

@shari-sushi
Copy link
Owner Author

shari-sushi commented Jan 26, 2024

そもそも、これでdb接続失敗しても落ないわ

  var err error
  db, err = gorm.Open(mysql.Open(path), &gorm.Config{})
  db = db.Debug()
  if err != nil {
    // panic("failed to connect database")
  }
  // migration()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant