Condor

[Under Development]
What is Condor?
Condor is a golang web framework with an MVC like architecture, it's based on Gin framework, it provides you with an easy-to-use directory structure with a development experience similar to Laravel, made for developing modern APIs and microservices.
Full docmentation is available at Condor Docs.
Features
- Router
- Middlewares
- JWT tokens
- ORM (GORM)
- Cache (Redis)
- TLS
- Context Package Integrator
- Live-Reloading for development
- Features Control
Create a new project
To create a new Condor project you need to install the Condor cli first
Install Condor cli
To install the Condor cli run the following command
go get github.com/gocondor/installer/condor
Create a project using Condor cli:
To create a new project run the following command:
condor new my-project github.com/my-organization/my-project
Getting started
First create a project by following the steps above.
Now Let's create a route to handle our first request
let's start by defining the handler function for the request, create a file with the name example.go in httpd/handlers folder with the following content:
package handlers
import (
"github.com/gin-gonic/gin"
)
func ExampleShow(c *gin.Context) {
message := "Hello from example handler!"
c.JSON(200, gin.H{
"message": message,
})
}
Next lets define the route, to do that open up the file httpd/routes.go, then inside the function RegisterRoutes() add to this line router.Get("/", handlers.ExampleShow) and make sure it looks like below:
func RegisterRoutes() {
router := routing.Resolve()
// Define your routes here
router.Get("/", handlers.ExampleShow)
}
Next start the app by running the following code from inside the project:
condor run:dev
Finally, open up your browser and navigate to localhost:8000
Architecture
the architecture is similar to MVC architecture, there is a routes.go file where you can define all your routes and their handlers, the handler is simply a method that gets executed when the request is received, you can think of it like a controllers action in MVC
The request journey looks like below:
request -> routing -> middleware -> handler -> middleware -> json response
Folder structure
├── condor
│ ├── config/ ---------------> control what features to turn on
│ ├── httpd/-----------------> http related code
│ │ ├── handlers/ --------------> contains your http requests handlers
│ │ ├── middlewares/ -----------> middlewares are defined here
│ ├── routes.go -------------> your routes are defined here
│ ├── integrations/ ---------> contains the integrations of third party packages into gin context
│ ├── logs/ -----------------> log files
│ ├── models/ ---------------> database models
│ ├── ssl/ ------------------> ssl certificates
│ ├── .env ------------------> environment variables
│ ├── .gitignore ------------> gitignore file
│ ├── go.mod ----------------> go modules the project depends on
│ ├── LICENSE ---------------> license
│ ├── main.go ---------------> ssl certificates
│ ├── README.md -------------> readme file