Sankie005 commited on
Commit
10e884d
1 Parent(s): 641452a

Initial commit

Browse files
Files changed (4) hide show
  1. app/__init__.py +0 -0
  2. app/html/index.html +129 -0
  3. app/main.py +16 -0
  4. requirements.txt +2 -0
app/__init__.py ADDED
File without changes
app/html/index.html ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <link rel="preconnect" href="https://fonts.googleapis.com">
8
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
9
+ <link href="https://fonts.googleapis.com/css2?family=Cabin:wght@600&display=swap" rel="stylesheet">
10
+ <title >Freehost</title>
11
+ <style>
12
+ body {
13
+ font-family: 'Cabin', sans-serif;
14
+ margin: 0;
15
+ padding: 0;
16
+ background: linear-gradient(109.6deg, rgba(0, 0, 0, 0.93) 11.2%, rgb(63, 61, 61) 78.9%);
17
+ color: #2c3e50;
18
+ }
19
+ header {
20
+ text-align: center;
21
+ padding: 10px;
22
+ background-image: repeating-linear-gradient(135deg, rgb(0,0,0) 0px, rgb(0,0,0) 10px,transparent 10px, transparent 11px),repeating-linear-gradient(22.5deg, rgb(0,0,0) 0px, rgb(0,0,0) 10px,transparent 10px, transparent 11px),linear-gradient(90deg, hsl(194,74%,56%),hsl(266,74%,56%),hsl(338,74%,56%),hsl(50,74%,56%),hsl(122,74%,56%));
23
+ color: #fff;
24
+ border-bottom-left-radius: 20px;
25
+ border-bottom-right-radius: 10px;
26
+ }
27
+ section {
28
+ max-width: 800px;
29
+ margin: 20px auto;
30
+ padding: 20px;
31
+ background-color: #fff;
32
+ border: 1px solid #bdc3c7;
33
+ border-radius: 10px;
34
+ }
35
+ title {
36
+ color: white;
37
+ font-size: xx-large;
38
+ }
39
+ h1 {
40
+ color: #1807aa;
41
+ font-family: 'Cabin', sans-serif;
42
+ font-size: 2em; /* Increased font size */
43
+ }
44
+ h2 {
45
+ color: black;
46
+ }
47
+ h3 {
48
+ color: white;
49
+ font-size: 68px;
50
+ padding: auto;
51
+ font-weight: bolder;
52
+ font-family: 'Cabin', sans-serif;
53
+ }
54
+ #navigateButton {
55
+ display: inline-block;
56
+ padding: 10px 20px;
57
+ margin-top: 10px;
58
+ background-color: black;
59
+ color: #fff;
60
+ text-decoration: none;
61
+ border-radius: 5px;
62
+ transition: background-color 0.3s;
63
+ }
64
+ #navigateButton:hover {
65
+ background-color: #2980b9;
66
+ color:white;
67
+ }
68
+ footer {
69
+ text-align: center;
70
+ padding: 10px;
71
+ background-image: repeating-linear-gradient(135deg, rgb(0,0,0) 0px, rgb(0,0,0) 10px,transparent 10px, transparent 11px),repeating-linear-gradient(22.5deg, rgb(0,0,0) 0px, rgb(0,0,0) 10px,transparent 10px, transparent 11px),linear-gradient(90deg, hsl(194,74%,56%),hsl(266,74%,56%),hsl(338,74%,56%),hsl(50,74%,56%),hsl(122,74%,56%));
72
+ color: #fff;
73
+ border-top-left-radius: 10px;
74
+ border-top-right-radius: 10px;
75
+ }
76
+ /* Added the following CSS rule to make content bold */
77
+ section p {
78
+ font-weight: bold;
79
+ font-family: 'Rubik', sans-serif;
80
+ }
81
+ </style>
82
+ </head>
83
+ <body>
84
+ <header>
85
+ <h3>Free Host</h3>
86
+ <h3 style="font-size: medium;">Host your own webpages for free!</h3>
87
+ </header>
88
+
89
+ <section>
90
+ <h2>About</h2>
91
+ <p>
92
+ <strong>Freehost is a useful tool that i spun off from another project that i contributed to that allows students to host their webpages and deploy their apps for free on the internet without having to pay for costly cloud computing or hosting charges</strong>
93
+ </p>
94
+ </section>
95
+
96
+ <section>
97
+ <h2>Documentation</h2>
98
+ <p>
99
+ <strong>To look at the Docs page of FastAPI click the button below
100
+ </p>
101
+ <p>
102
+ <a id="navigateButton">API Documentation</a>
103
+ <script>
104
+ document.getElementById('navigateButton').addEventListener('click', function() {
105
+ // Get the current URL
106
+ var currentUrl = window.location.href;
107
+
108
+ // Append "/docs" to the current URL
109
+ var newUrl = currentUrl + 'docs';
110
+
111
+ // Navigate to the new URL
112
+ window.location.href = newUrl;
113
+ });
114
+ </script>
115
+ </p>
116
+ </section>
117
+ <section>
118
+ <h2> Crediting and usage</h2>
119
+ <p>
120
+ <strong> If you wish to use Freehost in your own projects and credit me then feel free to link my <a href="https://github.com/Sankie005">Github</a> or <a href="https://linkedin.com/in/sankritya-rai-002a40261/">Linkedin</a> in your website footer
121
+ </p>
122
+
123
+ </section>
124
+
125
+ <footer>
126
+ <p>&copy; 2023 Sankie005 on github</p>
127
+ </footer>
128
+ </body>
129
+ </html>
app/main.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI, HTTPException,APIRouter,Request
2
+ from pydantic import BaseModel
3
+ from fastapi.responses import HTMLResponse
4
+ from fastapi.staticfiles import StaticFiles
5
+ from starlette.responses import FileResponse
6
+ from fastapi.middleware.cors import CORSMiddleware
7
+ app = FastAPI()
8
+ origins = ["*"]
9
+ app.add_middleware(
10
+ CORSMiddleware,
11
+ allow_origins=origins,
12
+ )
13
+ app.mount("/files/", StaticFiles(directory='../code'), name="index")
14
+ @app.get("/")
15
+ async def read_index():
16
+ return FileResponse('app/html/index.html')
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastapi
2
+ uvicorn[standard]