Skip to content
Merged

pull #18

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Backend/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PORT=
CORS_ORIGIN=
27 changes: 27 additions & 0 deletions Backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

package-lock.json
.env
34 changes: 34 additions & 0 deletions Backend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "backend",
"version": "1.0.0",
"description": "Backend for Project-Assemble",
"main": "index.js",
"type": "module",
"scripts": {
"dev": "nodemon -r dotenv/config --experimental-json-modules src/index.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/TheGradients/Assemble.git"
},
"keywords": [
"node",
"javascript",
"backend"
],
"author": "TheGradients",
"license": "ISC",
"bugs": {
"url": "https://github.com/TheGradients/Assemble/issues"
},
"homepage": "https://github.com/TheGradients/Assemble#readme",
"dependencies": {
"body-parser": "^1.20.2",
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"express": "^4.19.2",
"mongoose": "^8.4.4",
"nodemon": "^3.1.4"
}
}
28 changes: 28 additions & 0 deletions Backend/src/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import express from "express";
import cors from "cors";
import cookieParser from "cookie-parser";

const app = express();

app.use(cors({
origin: process.env.CORS_ORIGIN,
credentials: true
}));

app.use(express.json({
limit: "16kb"
}));

app.use(express.urlencoded({
extended: true,
limit: "16kb"
}));

app.use(cookieParser());

// HEALTH CHECK ROUTE
import healthRouter from "./routes/healthcheck.routes.js";

app.use("/api/v1", healthRouter);

export default app;
File renamed without changes.
19 changes: 19 additions & 0 deletions Backend/src/controllers/healthcheck.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import asyncHandler from "../utils/asyncHandler.js";
import ApiResponse from "../utils/ApiResponse.js";
import ApiError from "../utils/ApiError.js";

const healthCheck = asyncHandler( async (req, res) => {
return res
.status(200)
.json(
new ApiResponse(
200,
[],
"API Is Running Good!"
)
);
});

export {
healthCheck
};
Empty file added Backend/src/db/.gitkeep
Empty file.
10 changes: 10 additions & 0 deletions Backend/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import dotenv from "dotenv";
import app from "./app.js";

dotenv.config({
path: './env'
});

app.listen(process.env.PORT || 8000, () => {
console.log(`App Started On Port: ${process.env.PORT}`);;
});
Empty file.
Empty file added Backend/src/models/.gitkeep
Empty file.
8 changes: 8 additions & 0 deletions Backend/src/routes/healthcheck.routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Router } from "express";
import { healthCheck } from "../controllers/healthCheck.controller.js";

const router = Router();

router.route("/health-check").get(healthCheck);

export default router;
23 changes: 23 additions & 0 deletions Backend/src/utils/ApiError.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class ApiError extends Error {
constructor(
statusCode,
message = "Something Went Wrong!",
errors = [],
stack
) {
super(message)
this.statusCode = statusCode
this.data = []
this.message = message
this.success = false
this.errors = errors

if (stack) {
this.stack = stack
} else {
Error.captureStackTrace(this, this.constructor)
}
}
}

export default ApiError;
14 changes: 14 additions & 0 deletions Backend/src/utils/ApiResponse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class ApiResponse {
constructor(
statusCode,
data,
message = "Success!"
) {
this.statusCode = statusCode
this.data = data
this.message = message
this.success = statusCode < 400
}
}

export default ApiResponse;
9 changes: 9 additions & 0 deletions Backend/src/utils/asyncHandler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const asyncHanlder = (requestHandler) => {
return (req, res, next) => {
Promise
.resolve(requestHandler(req, res, next))
.catch((err) => next(err));
}
};

export default asyncHanlder;
2 changes: 2 additions & 0 deletions Frontend/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React from 'react'
import Body from './components/Body'
import Header from './components/Header'
const App = () => {
return (
<div>
<Header/>
<Body/>
</div>
)
Expand Down
28 changes: 28 additions & 0 deletions Frontend/src/components/Header.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react'

const Header = () => {
return (
<div>
<div className="navbar bg-zinc-700">
<div className="logo flex px-2 py-2 text-white">
<svg className='mt-1' width="50" height="50" viewBox="0 0 250 250" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M242.768 107.57C253.468 107.57 251.292 144.197 242.768 144.197C234.244 144.197 170.223 144.197 170.223 144.197V107.57C170.223 107.57 232.068 107.57 242.768 107.57Z" fill="white" />
<path d="M170.709 107.621C183.06 123.497 180.234 131.349 170.639 145.263C170.639 145.263 139.61 138.012 138.461 126.503C137.312 114.995 170.709 107.621 170.709 107.621Z" fill="#582000" />
<path d="M106.53 7.30279C106.53 -3.50206 142.802 -1.30467 142.802 7.30278C142.802 15.9102 142.802 80.5567 142.802 80.5567H106.53C106.53 80.5567 106.53 18.1076 106.53 7.30279Z" fill="white" />
<path d="M106.58 80.0655C122.302 67.5941 130.078 70.4474 143.857 80.1363C143.857 80.1363 136.676 111.468 125.279 112.629C113.882 113.789 106.58 80.0655 106.58 80.0655Z" fill="#582000" />
<path d="M7.23215 144.066C-3.46818 144.066 -1.29205 107.439 7.23214 107.439C15.7563 107.439 79.7775 107.439 79.7775 107.439V144.066C79.7775 144.066 17.9325 144.066 7.23215 144.066Z" fill="white" />
<path d="M79.2909 144.015C66.9401 128.139 69.7658 120.287 79.361 106.373C79.361 106.373 110.39 113.624 111.539 125.133C112.688 136.641 79.2909 144.015 79.2909 144.015Z" fill="#582000" />
<path d="M142.672 242.697C142.672 253.502 106.4 251.305 106.4 242.697C106.4 234.09 106.4 169.443 106.4 169.443H142.672C142.672 169.443 142.672 231.892 142.672 242.697Z" fill="white" />
<path d="M142.622 169.934C126.9 182.406 119.124 179.553 105.344 169.864C105.344 169.864 112.525 138.532 123.922 137.371C135.319 136.211 142.622 169.934 142.622 169.934Z" fill="#582000" />
</svg>
<div className="text"> <h3 className='text-s t1 ml-5 -mb-2 font-light font-["AgencyFB"] '>GAMEZONE UNITED INDIA</h3>
<h1 className='ml-3 -mt-4 text-[40px] font-bold font-["AgencyFB"]'>ASSEMBLE</h1></div>

</div>

</div>
</div>
)
}

export default Header