ybkuroki / go-webapp-sample Goto Github PK
View Code? Open in Web Editor NEWgolang, echo, gorm
License: MIT License
golang, echo, gorm
License: MIT License
GET https://***/api/auth/loginStatus 401 (Unauthorized)
Deploy this to server with nginx proxy_pass
successfully login
not solved yet.
To test Web APIs.
It can test with the test command for golang.
TBD
1、Use environment.
When there are multiple systems running, it is not very convenient
2、Start with parameters
In the development process, if unit testing is needed, especially using Golan, it seems inconvenient to do testing
Whether a third option can be added, using a relative path to load the configuration file .
To change Echo Logger to Zap Logger
The purpose of this ticket is to be improved quality of this sample, and to be able to find the bugs related it quickly when updates the version of some libraries or some source codes by covering the major test cases.
For create Web API for easy.
Expected the follwing behavior.
How do you fix it?
To make it easy to change logging settings.
The purpose of this ticket is to be able to manage the messages is returned by the system in the properties file.
The expected behavior is the followings:
We can't only check Web APIs of this application in README but also we would like to be able to check in Swagger UI.
Use swaggo/echo-swagger library
None
To allow only authorized users to see book datas.
Implement the following method.
The purpose of this ticket is to provide with the screen of this application without starting a web server of vuejs-webapp-sample project.
The expected behavior is the followings:
The application is connecting with my postgres server but not creating the master data
Why such a problem happened?
Changed the application.docker.yml file and added the following config
database:
dialect: postgres
host: localhost
port: 5432
dbname: testdb
username: admin
password: psltest
migration: true
Then I built the application go build main.go
Execute the app with ./main.exe -env=docker
The output is
PS C:\Users\Raja.Ramanujam\OneDrive - Neudesic\Documents\kube-monitoring\golangapp\go-webapp-sample> .\main.exe -env=docker
2022-11-08T18:27:39.688+0530 INFO logger/logger.go:62 Success to read zap logger configuration: zaplogger.docker.yml
2022-11-08T18:27:39.689+0530 INFO go-webapp-sample/main.go:41 Loaded this configuration : application.docker.yml
2022-11-08T18:27:39.689+0530 INFO repository/repository.go:50 Try database connection
2022-11-08T18:27:42.186+0530 INFO repository/repository.go:56 Success database connection, localhost:5432
/ // / ___
/ // / _ / _
//_////___/ v4.9.0
High performance, minimalist Go web framework
https://echo.labstack.com
_____________________________O/
O
⇨ http server started on [::]:8080
The master data is not generated as how it use to do when using the application.develop.yml file
PS C:\Users\Raja.Ramanujam\OneDrive - Neudesic\Documents\kube-monitoring\golangapp\go-webapp-sample> .\main.exe
2022-11-08T18:16:40.591+0530 INFO logger/logger.go:62 Success to read zap logger configuration: zaplogger.develop.yml
2022-11-08T18:16:40.592+0530 INFO go-webapp-sample/main.go:41 Loaded this configuration : application.develop.yml
2022-11-08T18:16:40.593+0530 INFO repository/repository.go:50 Try database connection
2022-11-08T18:16:40.611+0530 INFO repository/repository.go:56 Success database connection, book.db:
2022-11-08T18:16:40.629+0530 DEBUG logger/gormlogger.go:58 [gorm] INSERT INTO authority_master
(name
) VALUES ("Admin") RETURNING id
2022-11-08T18:16:40.700+0530 DEBUG logger/gormlogger.go:58 [gorm] INSERT INTO account_master
(name
,password
,authority_id
) VALUES ("test","$2a$10$TiX8wtNwK6QgnRQnfSkxvuBstQcteN0NcCdW7fDT3XyNpjJnVhqme",2) RETURNING id
2022-11-08T18:16:40.766+0530 DEBUG logger/gormlogger.go:58 [gorm] INSERT INTO account_master
(name
,password
,authority_id
) VALUES ("test2","$2a$10$Py4EzSdPWU6w0uECT8KXRud5wWWGLWDaHHv7wzwCayqV0tSOOhN5e",2) RETURNING id
2022-11-08T18:16:40.772+0530 DEBUG logger/gormlogger.go:58 [gorm] INSERT INTO category_master
(name
) VALUES ("Technical Book") RETURNING id
2022-11-08T18:16:40.780+0530 DEBUG logger/gormlogger.go:58 [gorm] INSERT INTO category_master
(name
) VALUES ("Magazine") RETURNING id
2022-11-08T18:16:40.787+0530 DEBUG logger/gormlogger.go:58 [gorm] INSERT INTO category_master
(name
) VALUES ("Novel") RETURNING id
2022-11-08T18:16:40.795+0530 DEBUG logger/gormlogger.go:58 [gorm] INSERT INTO format_master
(name
) VALUES ("Paper Book") RETURNING id
2022-11-08T18:16:40.869+0530 INFO middleware/middleware.go:132 Served the static contents.
How do you fix it?
Add transaction to repository.
This web application can be deployed in different environments such as development or production by allowing to switch the configuration settings.
This application can switch different environment by changing runtime parameter.
Getting the following error when try to get the source code
sqlite3-binding.c: In function 'sqlite3SelectNew':
sqlite3-binding.c:128049:10: warning: function may return address of local variable [-Wreturn-local-addr]
128049 | return pNew;
| ^~~~
sqlite3-binding.c:128009:10: note: declared here
128009 | Select standin;
| ^~~~~~~
Why such a problem happened?
Perform the follwing steps to reproduce the problem.
It seems to me that in services accessing a logger from a container is quite inconvenient, so why did you choose to explicitly pass a container instance to every service?
There might be the following option to do that:
Update golang version from 1.16 to 1.17.
Write the actual behavior and the purpose to modify.
IN the READ.md file under the Project map section, the following is spelt wrongly.
Why such a problem happened?
Perform the follwing steps to reproduce the problem.
Expected the follwing behavior.
How do you fix it?
To easy dependencies management.
Perform the following steps:
$ go get -u github.com/golang/dep/cmd/dep
$ cd GOPATH/src/github.com/ybkuroki/go-webapp-sample
$ dep init
$ go run main.go
Perform the following steps:
$ dep ensure
The purpose of this ticket is to be able to use session data at anywhere by adding session to context.
The behavior isn't changed by fixing this issue.
I forked the repo to practice devops(CICD with Jenkins) and from my personal GitHub, I cloned the repo, and I was following the steps mentioned in the readme. However, I have issues with the running of application as it says database connection failure. I couldn't find any information on setting up db in the readme. Also, please note that I already have go installed in my machine along with VS code. I didn't bother to install MinGW(gcc).
If we need to configure db, that details are not updated, due to which may be this issue.
Perform the follwing steps to reproduce the problem.
If we follow steps mentioned in readme, we should be able to run the app without any issue
The remaining issues are as follows.
Entity Name | Before | After |
---|---|---|
Category | categories | category_master |
Format | formats | format_master |
I will rise as separate issues if it necessary.
The purpose of this issue is to consider about we will want to add what features and improvement in the future.
There is the following remain issues in this repository.
I would like to resolve those issues by discussing with some contributors.
This is some improvements which I considered in the past:
Write the actual behavior and the purpose to modify.
go test -v .
gives out below error:
? github.com/ybkuroki/go-webapp-sample [no test files]
Perform the follwing steps to reproduce the problem.
go test -v .
To refactor Web APIs.
Service Name | ASIS URL | ASIS Method | TOBE URL | TOBE Method |
---|---|---|---|---|
Get Service | /api/book?id=[BOOK_ID] |
GET | /api/books/:id |
GET |
List Service | /api/book/list?page=[PAGE_NUMBER]&size=[PAGE_SIZE] |
GET | /api/books?page=[PAGE_NUMBER]&size=[PAGE_SIZE] |
GET |
Regist Service | /api/book/new |
POST | /api/books |
POST |
Edit Service | /api/book/edit |
POST | /api/books |
PUT |
Delete Service | /api/book/delete |
POST | /api/books |
DELETE |
Search Title Service | /api/book/search?query=[KEYWORD]&page=[PAGE_NUMBER]&size=[PAGE_SIZE] |
GET | /api/books?query=[KEYWORD]&page=[PAGE_NUMBER]&size=[PAGE_SIZE] |
GET |
Service Name | ASIS URL | ASIS Method | TOBE URL | TOBE Method |
---|---|---|---|---|
Login Service | /api/account/login |
POST | /api/auth/login |
POST |
Logout Service | /api/account/logout |
POST | /api/auth/logout |
POST |
Login Status Check Service | /api/account/loginStatus |
GET | /api/auth/loginStatus |
GET |
Login Username Service | /api/account/loginAccount |
GET | /api/auth/loginAccount |
GET |
Service Name | ASIS URL | ASIS Method | TOBE URL | TOBE Method |
---|---|---|---|---|
Category List Service | /api/master/category |
GET | /api/categories |
GET |
Format List Service | /api/master/format |
GET | /api/formats |
GET |
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.