Skip to content

Commit

Permalink
docs: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
kareemmahlees committed Feb 4, 2024
1 parent 79fb91e commit ffa5ece
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 105 deletions.
29 changes: 11 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<h1 align='center'>
MySQL Meta
MetaX
</h1>
<p align='center'>
RESTfull & GraphQL API to manage your MySQL Database
</p>
RESTfull & GraphQL API for your database</p>

<div align='center'>

Expand All @@ -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)

Expand All @@ -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

Expand Down
29 changes: 0 additions & 29 deletions docker-compose.yml

This file was deleted.

58 changes: 0 additions & 58 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
}

0 comments on commit ffa5ece

Please sign in to comment.