Newer
Older
- Server is a golang gin framework developed at Go v1.20.08+
- Before running update following files according to environment:
- Update db related config in - `database.json`
- Server requires mongodb database (version 4.4.13)
- To run:
- `go mod tidy`
- `go run main.go`
- To Build:
- To log errors from commandline, prepare build in `Production` mode.
- Set `IS_PRODUCTION = true` in **main.go** file for production build. And create build with below command.
```go
go build -tags prod
```
- `GoTemplate.postman_collection.json` postman collection.
- To check pprof uncomment pprof call from main file.
- Use profiling for your server see the documentation <https://pkg.go.dev/net/http/pprof>
- also after starting pprof server use this command to check profiling
`go tool pprof http://localhost:YOUR_PPROF_PORT/debug/pprof/heap`
- To use jwt authentication and its variables uncomment decodeToken method to access all token variables.
- To get Mysql DB connection using provided json file just uncomment the `InitMysqlDBConnectionUsingJson` method from main file.
- To get sql server connection using provided json file just uncomment the `InitSQLServerConnectionUsingJson` method from main file.
- There are two ways we can get connection object.
1. first is using GetSQLServerDAO() method:
`GetSQLServerDAO()` returns the default sql server connection object.
2. second is using GetSQLServerDAOWithHost("hostName") method:
`GetSQLServerDAOWithHost("hostName")` returns the sql server connection object of specified HostName.
This method is used when we need to get connection object, other than default database.
## Immudb Operations
- To get immudb server connection using provided json file just uncomment the `InitImmuDBConnectionUsingJson` method from main file.
- To get the connection object GetImmuDAOWithHost(coreimmudb.DefaultHostName) method is used.
`GetImmuDAOWithHost(coreimmudb.DefaultHostName)` returns the immudb server connection object of specified HostName. This method is used when we need to get connection object, other than default database.
Note: All Immudb operations' result is in Base64 format.