diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2023-09-02 20:12:53 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2023-09-02 20:12:53 +0530 |
commit | 127d4fb8ee7f8b141f9fb2f1a8fda45d350f34fc (patch) | |
tree | 071e5e3cc928c7f0ad45430a971f8c9f9a856d96 /main.go |
first commitv0.0.1
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 55 |
1 files changed, 55 insertions, 0 deletions
@@ -0,0 +1,55 @@ +/* openbills - Server for web based Libre Billing Software + * Copyright (C) 2023 Vidhu Kant Sharma <vidhukant@vidhukant.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package main + +import ( + // used internally + _ "vidhukant.com/openbills/conf" + _ "vidhukant.com/openbills/db" + + // middlewares, etc + "vidhukant.com/openbills/errors" + + // routes + "vidhukant.com/openbills/customer" + "vidhukant.com/openbills/item" + + "github.com/gin-gonic/gin" + "github.com/spf13/viper" + + "log" +) + +const OPENBILLS_VERSION = "v0.0.1" + +func main() { + log.Printf("\x1b[46m\x1b[30m[info]\x1b[0m Starting OpenBills Server %s\n", OPENBILLS_VERSION) + + r := gin.New() + + r.GET("/info", serverInfo) + + api := r.Group("/api") + api.Use(errors.ErrResponse()) + { + customer.Routes(api) + item.Routes(api) + } + + r.Run(":" + viper.GetString("port")) +} |