{"id":23672770,"url":"https://github.com/kianbeh/krabttp","last_synced_at":"2025-07-17T16:35:52.645Z","repository":{"id":179864337,"uuid":"664245645","full_name":"kianbeh/krabTTp","owner":"kianbeh","description":"Back-end framework/server with rust🦀","archived":false,"fork":false,"pushed_at":"2023-07-13T16:18:55.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-29T11:19:18.643Z","etag":null,"topics":["backend","http","rust","server"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kianbeh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-09T11:23:28.000Z","updated_at":"2024-02-08T07:43:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"02555457-76f0-43b2-acaf-430ce831e2fe","html_url":"https://github.com/kianbeh/krabTTp","commit_stats":null,"previous_names":["tonycoc/krabttp","kianbeh/krabttp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kianbeh%2FkrabTTp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kianbeh%2FkrabTTp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kianbeh%2FkrabTTp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kianbeh%2FkrabTTp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kianbeh","download_url":"https://codeload.github.com/kianbeh/krabTTp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239699423,"owners_count":19682537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","http","rust","server"],"created_at":"2024-12-29T11:19:21.778Z","updated_at":"2025-02-19T16:49:36.732Z","avatar_url":"https://github.com/kianbeh.png","language":"Rust","readme":"# krabTTp\nBack-end framework/server with rust🦀\n\n\n# Introduction\nkrabTTp🦀 is a (simple)rust framework for develooping back-end of your website\n\nand it'll be more reliable, secure, advanced and productive in future\n\n\n# Idea\ni'm a Back-end Developer since 2021(noob) and i'm still learning about django and python so i came up with this idea to make a Back-end Development framework for Rust \nbecause i found rust so fast⚡, secure🔐 and intersint🙄 lang\n\n# using\n\n\n## views and urls\n`lib.rs` after `handle_connection` function you can handle requests with views and defining urls like:\n```\nif route(buf, \"/\".to_string() ,Method::GET){\n\n                    let response = Response{\n                        status:\"200\".to_string(),\n                        template:Some(format!(\"./{}/index.html\",settings.templates).to_string()),\n                        context: None // context should be Some(HashMap\u003cString,String\u003e)\n                    };\n\n                                       \n                    match stream.write(response.create().as_bytes()) {\n                        Ok(_) =\u003e stream.flush().unwrap(),\n                        Err(_) =\u003e println!(\"Connection reseted (maybe it's an attack)\")\n\n                    };\n                }\n```\nor\n```\nif route(buf, \"/info\".to_string(), Method::POST) {\n                    \n                    let response = Response{\n                        template:Some(format!(\"./{}/info.html\",settings.templates).to_string()),, can be None if you dont want to send a respond after a post request\n                        status:\"200\".to_string()\n                        context:None //should be Non\n                    };\n\n                    let post = POST{  //getting data from post requst\n                            request:buf\n                        };\n                    \n                    for (k,v) in post.all(){\n                        print!(\"{}:{} \\n\",k,v)\n                    }\n                    \n\n                    match stream.write(response.create().as_bytes()) {\n                        Ok(_) =\u003e stream.flush().unwrap(),\n                        Err(_) =\u003e println!(\"Connection reseted (maybe it's an attack)\")\n\n                    };\n```\nfor Post requests\n\n# sending context to template\n\n`src/lib.rs`\n\n```\n\nif route(buf, \"/\".to_string() ,Method::GET){\n\n                    let response = Response{\n                        status:\"200\".to_string(),\n                        template:Some(format!(\"./{}/index.html\",settings.templates).to_string()),\n\n                        /// key(\"ip\".to_string()) and value(settings.ip) you should add key in your html code\n                        with %%key%% format and then BackToFront function can read it and replace it with the value associated with key///\n\n                        context: Some(HashMap::from([(\"ip\".to_string(),settings.ip) \n                                                    ,(\"port\".to_string(),settings.port)\n                        ]))\n                        // context should be Some(HashMap\u003cString,String\u003e)\n                        \n                    };\n\n\n                                       \n                    match stream.write(response.create().as_bytes()) {\n                        Ok(_) =\u003e stream.flush().unwrap(),\n                        Err(_) =\u003e println!(\"Connection reseted (maybe it's an attack)\")\n\n                    };\n                }\n}\n```\n\n`templates/index.html` \n\nnote : replace `index.html` with template that you defined a view for it\n\n```\n\u003ch1\u003eYour \u003cspan style=\"color: red;\"\u003ekrabTTp\u003c/span\u003e🦀 website is running on %%ip%%:%%port%%\u003c/h1\u003e \n\n```\nin this code im replacing ip and port key with their defined values in context and using *%%key%%* format\n\n\n# last thing\nthis project is not even near to be completed but i'm working On it \nand i can use your help for making this better💚🤍❤\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkianbeh%2Fkrabttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkianbeh%2Fkrabttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkianbeh%2Fkrabttp/lists"}