-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
23 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
MONGODB_URI="mongodb+srv://andyluu:RhTdUUNFlwrJdAGY@andyluu.uzkteb7.mongodb.net/?retryWrites=true&w=majority&appName=andyluu" | ||
NODE_ENV=development | ||
MONGODB_URI="mongodb+srv://andyluu:Aixw2YLVw7eddgAU@andyluu.uzkteb7.mongodb.net/?retryWrites=true&w=majority&appName=andyluu" | ||
PORT=3000 | ||
DATABASE_NAME=andyluu | ||
EDUCATION_DATABASE_NAME=education | ||
API_URL=http://localhost:3000/api | ||
API_KEY=MbQoaQQTAfThmN7c9e7nDYeQYY3pChMBiaybo3tq | ||
REACT_APP_API_URL=http://localhost:3000/api | ||
REACT_APP_API_KEY=MbQoaQQTAfThmN7c9e7nDYeQYY3pChMBiaybo3tq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import axios from "axios"; | ||
|
||
export default axios.create({ | ||
baseURL: process.env.API_URL, | ||
baseURL: process.env.REACT_APP_API_URL, | ||
headers: { | ||
"Content-Type": "application/json", | ||
"API_KEY": process.env.REACT_APP_API_KEY, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { NextResponse } from "next/server"; | ||
import type { NextRequest } from "next/server"; | ||
|
||
export const middleware = (request: NextRequest) => { | ||
const apiKey = request.headers.get("API_KEY"); | ||
|
||
if (apiKey !== process.env.REACT_APP_API_KEY) { | ||
return new NextResponse(null, { | ||
status: 401, | ||
statusText: "Invalid API Key", | ||
headers: { "Content-Type": "application/json" }, | ||
}); | ||
} | ||
|
||
return NextResponse.next(); | ||
}; | ||
|
||
export const config = { matcher: "/api/:path*" }; |
0c726e4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
andy1uu-github-io – ./
andy1uu-github-io-andy-luus-projects.vercel.app
andyluu.vercel.app
andy1uu-github-io-git-master-andy-luus-projects.vercel.app