-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
35 lines (29 loc) · 817 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
package main
import (
"log"
"os"
"github.com/Bravoezz/first-fiber/db"
"github.com/Bravoezz/first-fiber/server"
)
func main() {
// db connection
db.InitDbConnection()
// db.Migrate()
dir := "storage"
// Verificar si el directorio ya existe
if _, err := os.Stat(dir); os.IsNotExist(err) {
// El directorio no existe, así que lo creamos
if err := os.Mkdir(dir, os.ModePerm); err != nil {
log.Fatal(err)
}
log.Println("Directorio creado:", dir)
} else if err != nil {
// Error al verificar la existencia del directorio
log.Fatal(err)
} else {
// El directorio ya existe, no es necesario crearlo nuevamente
log.Println("El directorio", dir, "ya existe.")
}
server := server.New("4000")
server.Start()
}