Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rust implementation #292

Open
wants to merge 72 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
4468b38
add: simple rust api server
Romira915 Jun 7, 2022
29c7bf8
fix: DB host and port
Romira915 Jun 7, 2022
a9ef111
add: dsn
Romira915 Jun 7, 2022
edbc5c0
features: get initialize
Romira915 Jun 8, 2022
e47dc12
add: todo func
Romira915 Jun 8, 2022
44df9ac
add: static dir
Romira915 Jun 9, 2022
93f4394
add: html template 分割
Romira915 Jun 9, 2022
c1a18bb
add: register.html
Romira915 Jun 9, 2022
09df39a
test tiny
Romira915 Jun 9, 2022
ebc4600
add: get_session_user
Romira915 Jun 9, 2022
777f4ae
features: get get_register
Romira915 Jun 9, 2022
8fc8e90
fix: session var
Romira915 Jun 9, 2022
cea6822
add: regex
Romira915 Jun 10, 2022
44f315d
add: form
Romira915 Jun 10, 2022
cfc6da8
features: register
Romira915 Jun 10, 2022
9967f48
add: todo get_flash
Romira915 Jun 10, 2022
d6ce708
fix: get_flash in get_register
Romira915 Jun 10, 2022
63edf8a
features: post_login
Romira915 Jun 10, 2022
a0e5b96
features: get_login
Romira915 Jun 10, 2022
f0992e8
features: make_posts
Romira915 Jun 10, 2022
c0c9069
Merge pull request #1 from Romira915/feature/login
Romira915 Jun 10, 2022
e294c93
add: todo
Romira915 Jun 10, 2022
c6b9fc3
create: template html
Romira915 Jun 10, 2022
bb1bdee
fix: template html
Romira915 Jun 14, 2022
ea152c4
add: image_url
Romira915 Jun 14, 2022
396202c
features: index /
Romira915 Jun 14, 2022
8358f04
fix: origin
Romira915 Jun 14, 2022
e476067
features: get_image
Romira915 Jun 14, 2022
93f458c
Merge pull request #2 from Romira915/feature/get_index
Romira915 Jun 14, 2022
db9c368
features: get_post_id
Romira915 Jun 15, 2022
de507a4
Merge pull request #19 from Romira915/feature/get_posts_id
Romira915 Jun 15, 2022
6673833
features: post_index
Romira915 Jun 15, 2022
ced1035
fix: show user name
Romira915 Jun 15, 2022
09f3251
fix: log level
Romira915 Jun 15, 2022
c2e67d7
fix: ref user page
Romira915 Jun 15, 2022
4ebe48c
Merge pull request #21 from Romira915/feature/post_index
Romira915 Jun 16, 2022
dc0e237
fix: 不要なコードを削除
Romira915 Jun 16, 2022
a8f9ce5
features: post_comment
Romira915 Jun 16, 2022
882a50b
features: get_admin_bannedを実装した・・・だけ
Romira915 Jun 16, 2022
63859db
fix: passhashの不具合修正
Romira915 Jun 16, 2022
4587449
fix: クエリパラメータをpayloadで受け取り
Romira915 Jun 16, 2022
6001fde
fix: post admin banned
Romira915 Jun 17, 2022
499e1db
features: post_admin_banned 実装
Romira915 Jun 17, 2022
f2e74f2
features: get_account_name 実装
Romira915 Jun 17, 2022
be2d762
fix: 表示ユーザがログインユーザとして表示される不具合を修正
Romira915 Jun 17, 2022
e719f0f
fix: bugを確認
Romira915 Jun 17, 2022
693cca2
bugfix: commented_countが正しくない不具合を修正
Romira915 Jun 17, 2022
f4bf4bc
fix: 例外処理を追加
Romira915 Jun 17, 2022
8dc87ff
fix: add NOTE
Romira915 Jun 17, 2022
330bec6
add: query param
Romira915 Jun 17, 2022
751e876
features: get_posts 実装
Romira915 Jun 17, 2022
7a6ad50
Merge pull request #22 from Romira915/rust
Romira915 Jun 17, 2022
7354b96
fix: 不要なhandleを削除
Romira915 Jun 18, 2022
87b8fd3
fix: 分離 pid ext
Romira915 Jun 18, 2022
ef88f11
Merge pull request #23 from Romira915/fix/get_image
Romira915 Jun 18, 2022
363a945
fix: cookiesessionでのベンチマークを確認
Romira915 Jun 18, 2022
af1d0a5
rm: template dir
Romira915 Jun 18, 2022
29f6b3a
resolve upstreamをmerge
Romira915 Jun 18, 2022
72165e5
fix: redisへの依存を削除
Romira915 Jun 18, 2022
e3f67db
exec: cargo fix
Romira915 Jun 18, 2022
8808e10
fix: cargo clippyに則った修正
Romira915 Jun 18, 2022
9bd48cc
rm: 不要なコメント削除
Romira915 Jun 18, 2022
262f96b
fix: log level
Romira915 Jun 18, 2022
4cee458
fix: golangの処理に準拠
Romira915 Jun 18, 2022
b3ba129
fix: cargo fix
Romira915 Jun 19, 2022
f65cefc
rm : .vscode
Romira915 Jun 19, 2022
9cb1397
fix: リンクミスを修正
Romira915 Jun 19, 2022
c08215d
fix: default app
Romira915 Jun 19, 2022
fd26f91
fix: golangの意図していない編集を修正
Romira915 Jun 19, 2022
9838a22
fix: cmd! to duct_sh
Romira915 Jun 19, 2022
486a6e9
fix: append about rust
Romira915 Jun 20, 2022
84467ae
fix: escape shell arg
Romira915 Jun 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
exec: cargo fix
Romira915 committed Jun 18, 2022

Unverified

This user has not yet uploaded their public signing key.
commit e3f67db7cd2779bb306a0d0921744d95e1c870d4
27 changes: 9 additions & 18 deletions webapp/rust/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
use std::{
any,
collections::HashMap,
env,
f32::consts::E,
io::{self, Write},
io::{self},
path::Path,
time::Duration,
};

use actix_cors::Cors;
use actix_files::Files;
use actix_multipart::{Field, Multipart, MultipartError};
use actix_redis::RedisSession;
use actix_multipart::{Field, Multipart};

use actix_session::{CookieSession, Session};
use actix_web::{
cookie::time::UtcOffset,
dev::ResourceDef,
error, get,
http::{
header::{self, ContentType},
Method, StatusCode,
},
get,
http::header::{self},
middleware, post,
web::{self, Bytes, Data, Form, Payload},
App, HttpRequest, HttpResponse, HttpServer, Result,
web::{self, Data, Form, Payload},
App, HttpResponse, HttpServer, Result,
};
use anyhow::{bail, Context};
use chrono::{DateTime, FixedOffset, Local, Utc};
use chrono::{DateTime, FixedOffset, Utc};
use derive_more::Constructor;
use duct::cmd;
use futures_util::TryStreamExt;
@@ -292,7 +285,7 @@ async fn make_post(
.context("Failed to query comment_count")?
.count;

let mut comments = if all_comments {
let comments = if all_comments {
sqlx::query_as!(
Comment,
"SELECT * FROM `comments` WHERE `post_id` = ? ORDER BY `created_at` DESC",
@@ -1318,8 +1311,6 @@ async fn main() -> io::Result<()> {
};
let dbname = env::var("ISUCONP_DB_NAME").unwrap_or("isuconp".to_string());

let redis_url = env::var("ISUCONP_REDIS_URL").unwrap_or("localhost:6379".to_string());

let dsn = if cfg!(debug_assertions) {
"mysql://root:root@localhost:3306/isuconp".to_string()
} else {