Skip to content

Commit

Permalink
somebug
Browse files Browse the repository at this point in the history
  • Loading branch information
imdeveshshukla committed Aug 17, 2024
1 parent eaf4cad commit 0d62e5e
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 16 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Build on PR
name: Build Quietly

on:
pull_request:
branches:
- build #stopped
- deploy #branch

jobs:
build:
Expand All @@ -14,9 +14,12 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: '20'


- name: Install Dependencies
run: npm install
working-directory: ./backend

- name: Run Build
run: npm run build
run: npm run deploy
working-directory: ./backend
8 changes: 3 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Build and Deploy to Docker Hub
name: Continuous Deployment

on:
push:
branches:
- deploy # Adjusted to trigger on pushes to master
- deploy # branch

jobs:
build-and-push:
Expand All @@ -12,8 +12,6 @@ jobs:
- name: Check Out Repo
uses: actions/checkout@v2

# - name: Prepare Dockerfile
# run: cp ./backend/Dockerfile ./Dockerfile

- name: Log in to Docker Hub
uses: docker/login-action@v1
Expand All @@ -33,7 +31,7 @@ jobs:
run: docker pull imdeveshshukla/quiet-backend

- name: Deploy
uses: appleboy/ssh-action@master #working
uses: appleboy/ssh-action@master #script
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
Expand Down
4 changes: 3 additions & 1 deletion backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ CLOUDINARY_API_KEY=""
CLOUDINARY_API_SECRET=""
SECRET_KEY=""
AUTH_EMAIL=""
AUTH_PASS=""
AUTH_PASS=""

NODE_ENV = "development"
7 changes: 4 additions & 3 deletions backend/src/controller/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const getUser = async (req, res) => {
if (typeof email !== "string")
return res.status(404).json({ msg: "invalid username" });
try {
console.log(email)
const user = await prisma.user.findUnique({
where: {
email: req.params.email,
Expand Down Expand Up @@ -83,13 +84,13 @@ const getUser = async (req, res) => {
},
},
});
// console.log(user);
console.log(user);

res.status(200).send({
return res.status(200).send({
user,
});
} catch (error) {
res.status(500).json({
return res.status(500).json({
msg: "Server/Database Error",
error: error.message,
});
Expand Down
2 changes: 1 addition & 1 deletion backend/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const app = express()
const port = 3000
const corsOptions = {
credentials: true,
origin: 'https://www.bequiet.live',
origin: (process.env.NODE_ENV === 'development')?'http://localhost:5173':'https://www.bequiet.live',
methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
allowedHeaders: [
"Origin",
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ function App() {
}
} catch (error) {
console.log(error);
if (error.response.status == 404) {
if (error.response?.status == 404) {
console.log("token not found");
} else if (error.response.status == 401) {
} else if (error.response?.status == 401) {
console.log("Invalid token");
}
}
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/utils/localhost.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
const baseAddress = "https://api.bequiet.live/"
const baseAddress = "http://localhost:3000/"

export default baseAddress;

0 comments on commit 0d62e5e

Please sign in to comment.