The following repository is for the backend assignment of the web development course I did in SUT in 2023 Spring, lectured by Dr. JafariNezhad.
We use the command below:
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout certs/nginx-selfsigned.key -out certs/nginx-selfsigned.crt
This command generates the key & cert needed by nginx to add the https directory.
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative services.proto
For more information to setup a gRPC server using go see the link below: https://www.practical-go-lessons.com/post/how-to-create-a-grpc-server-with-golang-ccdm795s4r5c70i1kacg
CREATE TYPE sex_type AS ENUM('male', 'female');
CREATE TABLE users (
name varchar(60) NOT NULL,
family varchar(60) NOT NULL,
id int PRIMARY KEY,
age int,
sex sex_type,
created_at timestamp NOT NULL DEFAULT NOW()
);
In order to run the project, simply run docker-compose up -d --build
All services will be built and run on the specified endpoints
To load test the services, you should cd into the load_test directory and execute locust
,
then you can open localhost:8089
and start load testing implemented services
You will most likely see something like this:
To generate the documentation for the service gateway, which is the main endpoint for the
system and processes RESTful requests, cd into the gateway, run swag init
.
Note that this command should be run after you have written annotations and comments for each endpoint and service you want documentation for.
After that when the service is up, the swagger endpoint will be accesible on the http://localhost/swagger/index.html
https://www.stackhawk.com/blog/golang-sql-injection-guide-examples-and-prevention/ this link will provide some pretty useful info