Skip to content

Commit

Permalink
Merge branch 'main' into bug/description-text-bookmark-section
Browse files Browse the repository at this point in the history
  • Loading branch information
panwar8279 authored Jun 13, 2024
2 parents 0a8a2ef + 6a19961 commit 6095d81
Show file tree
Hide file tree
Showing 35 changed files with 1,179 additions and 262 deletions.
2 changes: 1 addition & 1 deletion backend/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ app.use(bodyParser.urlencoded({ extended: true, limit: "50mb" }));

app.use(
cors({
origin: process.env.FRONTEND_URL.replace(/"/g, ""),
origin: 'http://localhost:3000',
credentials: true,
})
);
Expand Down
49 changes: 32 additions & 17 deletions backend/src/controllers/openSourceController.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,46 @@ require("dotenv").config();

const addProject = async (req, res) => {
try {
const {projectName, ownerUsername, tags, link, description} = req.body;
const { projectName, ownerUsername, tags, link, description } = req.body;

// Validation
if (!projectName || !ownerUsername || !link || !description) {
return res.status(400).json({ success: false, errors: ["All fields are required"] });
}

const newProject = await OpenSource.create({
projectName, ownerUsername, tags, link, description
})
});

if (!newProject)
return res.statsu(401).json({ success: false, errors: ["Issue Adding the Tool"] });

return res.status(201).json({ success: true });
}
catch (error) {
console.log(error);
if (!newProject) {
return res.status(401).json({ success: false, errors: ["Issue Adding the Tool"] });
}

return res.status(201).json({ success: true, project: newProject });
} catch (error) {
console.error(error);
return res.status(500).json({ success: false, errors: ["Internal Server Error"] });
}
}
};

const fetchAllProjects = async (req, res) => {
try {
const openSourceProjects = await OpenSource.find();
return res.status(200).json({ success: true, openSourceProjects: openSourceProjects });
}
catch (error) {
console.log(error);
const { page = 1, limit = 10 } = req.query;
const openSourceProjects = await OpenSource.find()
.skip((page - 1) * limit)
.limit(limit);

const totalProjects = await OpenSource.countDocuments();
return res.status(200).json({
success: true,
openSourceProjects,
totalPages: Math.ceil(totalProjects / limit),
currentPage: parseInt(page)
});
} catch (error) {
console.error(error);
return res.status(500).json({ success: false, errors: ["Internal Server Error"] });
}
}
};

module.exports = { addProject, fetchAllProjects };
module.exports = { addProject, fetchAllProjects };
115 changes: 82 additions & 33 deletions frontend/package-lock.json

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

10 changes: 7 additions & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@fortawesome/free-solid-svg-icons": "^6.5.2",
"@fortawesome/react-fontawesome": "^0.2.2",
"@reduxjs/toolkit": "^1.9.5",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"antd": "^5.6.4",
"aos": "^2.3.4",
"axios": "^1.6.1",
"axios": "^1.7.2",
"bootstrap": "^5.3.2",
"cheerio": "^1.0.0-rc.12",
"darkmode-js": "^1.5.7",
Expand All @@ -18,10 +22,10 @@
"lottie-react": "^2.4.0",
"mongodb": "^6.2.0",
"pagination": "^0.4.6",
"react": "^18.2.0",
"react": "^18.3.1",
"react-accessible-accordion": "^5.0.0",
"react-chatbot-kit": "^2.2.2",
"react-dom": "^18.2.0",
"react-dom": "^18.3.1",
"react-hot-toast": "^2.4.1",
"react-icons": "^4.12.0",
"react-paginate": "^8.2.0",
Expand Down
Binary file added frontend/public/copy-ai.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

gtag('config', 'G-6WS166VH7E');
</script>
<title>DEVLAPS</title>
<title>DEVLABS</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
Binary file added frontend/public/webflow.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6095d81

Please sign in to comment.