From ffa5ece2d0a8df844f8f206b775d03c61b48ad43 Mon Sep 17 00:00:00 2001 From: Kareem Mahlees Date: Sun, 4 Feb 2024 19:51:20 +0200 Subject: [PATCH] docs: update readme --- README.md | 29 +++++++++-------------- docker-compose.yml | 29 ----------------------- main.go | 58 ---------------------------------------------- 3 files changed, 11 insertions(+), 105 deletions(-) delete mode 100644 docker-compose.yml diff --git a/README.md b/README.md index dc21445..ccae073 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@

- MySQL Meta + MetaX

- RESTfull & GraphQL API to manage your MySQL Database -

+ RESTfull & GraphQL API for your database

@@ -15,7 +14,7 @@ ## What does it introduce -MySQL Meta introduces a RESTFull and GraphQL API that allows you to control your MySQL database through http requests, i.e creating tables and databases, adding columns and deleting columns. +**MetaX** introduces a _RESTFull_ and _GraphQL_ API that allows you to control your database through http requests programmatically, i.e creating tables and databases, adding columns and deleting columns, etc . ![Screen shot of running application](./docs/screenshot.png) @@ -37,33 +36,27 @@ MySQL Meta introduces a RESTFull and GraphQL API that allows you to control your ## Running -#### Environment Variables Setup +Once you [installed](#installation) the binary, _MetaX_ comes with subocommands to each you can supply your database connection parameters as command line flags. -Before starting the application, MySQL Meta expects some env vars to be set, you can find them also in the [.env.example](.env.example) file - -Once you [installed](#installation) the application you can run it like so: +You can find all about the commands by running with the `--help` flag: ```shell -mysql-meta +meta-x --help ``` -MySQL Meta by default serves on port 4000, you can configure the port by passing the `--port` flag: +_MetaX_ by default serves on port `5522`, you can configure the port by passing the `--port` flag: ```shell -mysql-meta --port 4444 +meta-x --port 4444 ``` ## Documentation -The API is fully documented, the REST version is documented using **Swagger Docs** and is served on `http://localhost:4000/swagger` - -Regarding the GraphQL version, you can run the application and then use the GraphQL endpoint `http://localhost:4000/graphql` to introspect the schema with your favorite tool, e.g postman, insomnia, hoppscotch. - -Additionally, you can playaround with the GraphQL version by jumping into the playground at `http://localhost:4000/playground` +The API is fully documented, the REST version is documented using **Swagger Docs** and is served on `http://localhost:5522/swagger` -## With Postman +Regarding the GraphQL version, you can run the application and then use the GraphQL endpoint `http://localhost:5522/graphql` to introspect the schema with your favorite tool, e.g postman, insomnia, hoppscotch. -MySQL Meta is well integrated with postman, you can import the collection along side it's documentation from the REST specification in the [postman collection folder](postman/collections/) +Additionally, you can playaround with the GraphQL version by jumping into the playground at `http://localhost:5522/playground` ## Progress Track diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 9d29c07..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,29 +0,0 @@ -version: "3.2" -services: - mysql-meta-db: - container_name: mysql-meta-db - image: mysql:latest - restart: always - environment: - - MYSQL_ROOT_PASSWORD=kareem - - MYSQL_DATABASE=mysqlmeta - - MYSQL_USER=kareem - - MYSQL_PASSWORD=password123 - ports: - - "3306:3306" - volumes: - - mysqldata:/var/lib/mysql - test: - container_name: mysql-meta-test - image: mysql:latest - restart: always - environment: - - MYSQL_ROOT_PASSWORD=kareem - - MYSQL_DATABASE=mysqlmeta - - MYSQL_USER=kareem - - MYSQL_PASSWORD=password123 - ports: - - "33061:3306" - -volumes: - mysqldata: diff --git a/main.go b/main.go index c63c0ed..e65c7f8 100644 --- a/main.go +++ b/main.go @@ -3,33 +3,8 @@ package main import ( "meta-x/cmd" _ "meta-x/docs" - - "github.com/jmoiron/sqlx" ) -var con *sqlx.DB -var port int -var err error - -// func init() { -// flag.IntVar(&port, "port", 4000, "port to listen on") -// provider := flag.String("provider", "", "database provider to connect with") -// flag.Parse() - -// _ = godotenv.Load() -// switch *provider { -// case "sqlite": -// // con, err = db.InitSQLiteConn() -// } -// con, err = db.InitDBConn() -// if err != nil { -// log.Error("Error connecting to DB") -// } -// if err := con.Ping(); err != nil { -// log.Error("Something wrong with DB" + err.Error()) -// } -// } - // Main // // @title MySQL Meta @@ -40,38 +15,5 @@ var err error // @host localhost:5522 // @BasePath / func main() { - // app := fiber.New(fiber.Config{ - // DisableStartupMessage: true, - // }) - // defer con.Close() - - // see https://github.com/99designs/gqlgen/issues/1664#issuecomment-1616620967 - // Create a gqlgen handler - // h := handler.NewDefaultServer(graph.NewExecutableSchema(graph.Config{Resolvers: &graph.Resolver{DB: con}})) - - // app.All("/graphql", func(c *fiber.Ctx) error { - // utils.GraphQLHandler(h.ServeHTTP)(c) - // return nil - // }) - - // app.All("/playground", func(c *fiber.Ctx) error { - // utils.GraphQLHandler(playground.Handler("GraphQL", "/graphql"))(c) - // return nil - // }) - - // app.Get("/swagger/*", swagger.HandlerDefault) - // app.Use(logger.New()) - - // routes.Setup(app, con) - - // fmt.Println(utils.NewStyle("REST", "#4B87FF"), fmt.Sprintf("http://localhost:%d", port)) - // fmt.Println(utils.NewStyle("Swagger", "#0EEBA1"), fmt.Sprintf("http://localhost:%d/swagger", port)) - // fmt.Println(utils.NewStyle("GraphQl", "#FF70FD"), fmt.Sprintf("http://localhost:%d/graphql", port)) - // fmt.Println(utils.NewStyle("Playground", "#B6B5B5"), fmt.Sprintf("http://localhost:%d/playground\n", port)) - - // if err := app.Listen(fmt.Sprintf(":%d", port)); err != nil { - // log.Error(err) - // } - cmd.Execute() }