Skip to content

Commit

Permalink
Merge pull request #27 from ambujraj/dev
Browse files Browse the repository at this point in the history
added cors for local test and header pages and speed insight
  • Loading branch information
ambujraj authored Feb 2, 2024
2 parents 79d7fb6 + 5c67776 commit 2c56c6c
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 0 deletions.
1 change: 1 addition & 0 deletions middleware/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
WEB_BASE_URL=http://localhost:3000
R2_ACCOUNT_ID=
R2_ACCESS_KEY=
R2_SECRET_KEY=
11 changes: 11 additions & 0 deletions middleware/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from fastapi import FastAPI, Request, HTTPException
from fastapi.middleware.cors import CORSMiddleware
from mangum import Mangum
from db import DynamoDBManager
from storage.cloudflare_r2 import CloudflareR2Manager
Expand All @@ -16,6 +17,16 @@
# Load Environment variables
load_dotenv()

# CORS (Cross Origin Resource Sharing) (for local)
web_base_url = str(os.getenv("WEB_BASE_URL"))
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)

# Storage
BUCKET_NAME = "byteshare-blob"
storage = CloudflareR2Manager(BUCKET_NAME)
Expand Down
1 change: 1 addition & 0 deletions middleware/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Resources:
R2_ACCOUNT_ID: !Ref R2AccountID
R2_ACCESS_KEY: !Ref R2AccessKey
R2_SECRET_KEY: !Ref R2SecretKey
WEB_BASE_URL: !Ref CorsOrigin
Events:
ApiEventWithProxy:
Type: Api
Expand Down
35 changes: 35 additions & 0 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@radix-ui/react-progress": "^1.0.3",
"@radix-ui/react-slot": "^1.0.2",
"@tanstack/react-table": "^8.11.7",
"@vercel/speed-insights": "^1.0.9",
"appwrite": "^13.0.1",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
Expand Down
11 changes: 11 additions & 0 deletions ui/src/app/(pages)/features/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react'

function FeaturesPage() {
return (
<div className="flex items-center justify-center h-screen">
<p>Coming Soon</p>
</div>
)
}

export default FeaturesPage
11 changes: 11 additions & 0 deletions ui/src/app/(pages)/feedback/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react'

function FeedbackPage() {
return (
<div className="flex items-center justify-center h-screen">
<p>Coming Soon</p>
</div>
)
}

export default FeedbackPage
11 changes: 11 additions & 0 deletions ui/src/app/(pages)/help/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react'

function HelpPage() {
return (
<div className="flex items-center justify-center h-screen">
<p>Coming Soon</p>
</div>
)
}

export default HelpPage
2 changes: 2 additions & 0 deletions ui/src/app/(pages)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import appwriteService from '@/authentication/appwrite/config'
import { AuthProvider } from '@/context/authContext'
import React, { useEffect, useState } from 'react'
import { SpeedInsights } from '@vercel/speed-insights/next'

const InternalLayout = ({ children }: { children: React.ReactNode }) => {
const [authorised, setAuthorised] = useState(false)
Expand All @@ -18,6 +19,7 @@ const InternalLayout = ({ children }: { children: React.ReactNode }) => {
<AuthProvider
value={{ authorised, setAuthorised, statusLoaded, setStatusLoaded }}
>
<SpeedInsights />
{children}
</AuthProvider>
)
Expand Down

0 comments on commit 2c56c6c

Please sign in to comment.