atcoder-problems-backend
is a set of backend applications written in Rust.
Since the web app, which is running on your local machine, connects to the production backend server, you don't need to run the backend applications in most cases.
Note that the following steps assume that your frontend application runs on http://localhost:3000 and your backend application runs on http://localhost:8080, which are the default values.
- Create a GitHub app.
Keep the client ID and the client secret.
- Remember to set the "User authorization callback URL" to
http://localhost:8080/internal-api/authorize
.
- Remember to set the "User authorization callback URL" to
- Launch an instance of PostgreSQL database on your machine.
Below are the list of files you need to modify:
atcoder-problems-backend/src/server/auth.rs
: changeredirect_url
tohttp://localhost:3000/atcoder/#/login/user
for your backend to redirect to your frontend web app after logging in.atcoder-problems-frontend/src/setupProxy.js
: changetarget
tohttp://localhost:8080
for your frontend web app to use your backend server.atcoder-problems-frontend/src/utils/Url.tsx
: changeGITHUB_LOGIN_LINK
tohttps://github.com/login/oauth/authorize?client_id=<YOUR_CLIENT_ID>
, where<YOUR_CLIENT_ID>
is the client ID of your GitHub app.- (For running backend tests)
atcoder-problems-backend/tests/utils.rs
: changeSQL_URL
to the correct connection URL. Note that it should be different from the database you intend to develop on.
Be careful not to commit these files to the Git repository.
cd atcoder-problems-backend/
cargo build
export SQL_URL=... # Connection URL of PostgreSQL
export CLIENT_ID=... # GitHub client_id, which is required to use the login function.
export CLIENT_SECRET=... # GitHub client_secret, which is required to use the login function.
# Run backend server
cargo run --bin run_server
# Run crawlers
cargo run --bin crawl_all_submissions
cargo run --bin crawl_for_virtual_contests
cargo run --bin crawl_from_new_contests
cargo run --bin crawl_problems
cargo run --bin crawl_recent_submissions
cargo run --bin crawl_whole_contest
# Run other tools
cargo run --bin batch_update
cargo run --bin delta_update
cargo run --bin dump_json
cargo run --bin fix_invalid_submissions