Skip to content

weiraneve/hok-lottery-actix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

abstract

This is an easy actix-web project.Just lottery hero for HOK. And same logic project clean architecture

I have kotlin SpringBoot project as some logic hok-lottery

apis

See the API documentation pages for more info.

sql

See lottery sql info for more sql info

usages

  1. Create database and tables, you can see it by lottery sql. this can be done in the terminal, then input your mysql root password four times.:

    ./sql/import_databases.sh

    If you don't want to test sql and use the shell script, you can create mysql database and use:

    mysql -u root -p lottery < ./sql/lottery.sql
  2. Create a .env file in this directory:

    SERVER_ADDR=127.0.0.1:8034
    DATABASE_URL=mysql://<username>:<password>@localhost:3306/lottery
    DATABASE_URL_TEST=mysql://<username>:<password>@localhost:3306/lottery_test

    or use shell script:

    echo "SERVER_ADDR=127.0.0.1:8034" >> .env
    echo "DATABASE_URL=mysql://<username>:<password>@localhost:3306/lottery" >> .env
    echo "DATABASE_URL_TEST=mysql://<username>:<password>@localhost:3306/lottery_test" >> .env

    Maybe you shouldn't use test db, then you can delete the test db shell script and env content.

  3. Run the server cargo run

architecture overview

my actix The Layered Architecture:

src
├── app_state.rs
├── controller
│  ├── mod.rs
│  ├── pick.rs
│  └── reset.rs
├── creat_app.rs
├── lib.rs
├── main.rs
├── model
│  ├── hero.rs
│  ├── log.rs
│  ├── mod.rs
│  ├── my_result.rs
│  ├── post_param.rs
│  ├── team.rs
│  └── team_query.rs
├── repository
│  ├── hero.rs
│  ├── log.rs
│  ├── mod.rs
│  └── team.rs
├── service
│  ├── mod.rs
│  ├── pick.rs
│  └── reset.rs
└── test
    ├── mod.rs
    ├── test_pick_controller.rs
    └── test_team_repository.rs

testing support

To run the tests, you can go src/test and use the following command:

cargo test

About

王者荣耀比赛后端

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published