Skip to content

Commit

Permalink
CatchAsync & SignToken modules created + tsnode added for server module
Browse files Browse the repository at this point in the history
- CatchAsync module has been added with MY PERSONAL IMPLEMENTATION OF CATCHASYNC
- SignToken module isn't known so added a Dummy Implementation
- TsNode added for starting server.ts

Fix: #22
  • Loading branch information
prabh1234assla authored and Girishbari committed May 23, 2024
1 parent fe23a6f commit e05fd02
Show file tree
Hide file tree
Showing 18 changed files with 197 additions and 134 deletions.
6 changes: 4 additions & 2 deletions apps/client/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"use client";

import { ChangeEvent, useRef, useState } from "react";
import { ChangeEvent, FC, useRef, useState } from "react";
import Navbar from "../navbar";
import { InputInit } from "../types/dashboard";

export default function form() {
const form: FC<{}> = () => {
const [inputData, setInputData] = useState<InputInit>({
userText: "",
customization: "",
Expand Down Expand Up @@ -153,3 +153,5 @@ export default function form() {
</>
);
}

export default form;
31 changes: 0 additions & 31 deletions apps/client/app/intro.js

This file was deleted.

5 changes: 3 additions & 2 deletions apps/client/app/intro.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"use client"
import { useRouter } from 'next/navigation';
import { FC } from 'react';

function intro() {
const intro: FC<{}> = () => {

const router = useRouter();

return (
<>
<div className="flex justify-start gap-5 hero-content text-center text-neutral-content">
Expand Down
31 changes: 0 additions & 31 deletions apps/client/app/layout.js

This file was deleted.

35 changes: 0 additions & 35 deletions apps/client/app/navbar.js

This file was deleted.

5 changes: 4 additions & 1 deletion apps/client/app/navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Link from "next/link"
import { FC } from "react"

export default function navbar() {
const navbar: FC<{}> = () => {
return (
<div className=" fixed top-0 navbar bg-base-200 md:px-7">
<div className="navbar-start">
Expand Down Expand Up @@ -33,3 +34,5 @@ export default function navbar() {
</div>
)
}

export default navbar;
20 changes: 0 additions & 20 deletions apps/client/app/page.js

This file was deleted.

5 changes: 4 additions & 1 deletion apps/client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@
"name": "next"
}
]
}
},
"exclude": [
"node_modules"
]
}
2 changes: 2 additions & 0 deletions apps/server/controllers/authController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { NextFunction, Response } from "express";
import jwt from "jsonwebtoken";
import { UserInit } from "../types/authController";
import { CookieOptions } from "../types/authController";
import signToken from "./signToken";
import catchAsync from "./catchAsync";

const createSendToken: (
user: UserInit,
Expand Down
7 changes: 7 additions & 0 deletions apps/server/controllers/catchAsync.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { NextFunction } from "express";

export default function catchAsync(asyncFunction: Function) {
return (req: Request, res: Response, next: NextFunction) => {
asyncFunction(req, res, next).catch(next);
};
}
5 changes: 5 additions & 0 deletions apps/server/controllers/signToken.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default function signToken(_id: string){
//no syntax declared in provided code!!!

return "";
}
3 changes: 2 additions & 1 deletion apps/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "node index.js"
"dev": "ts-node index.ts"
},
"dependencies": {
"@google/generative-ai": "^0.3.1",
Expand Down Expand Up @@ -33,6 +33,7 @@
"@types/pdfkit": "^0.13.4",
"@types/react": "18.3.2",
"autoprefixer": "^10.4.19",
"ts-node": "^10.9.2",
"typescript": "^5.4.5"
}
}
7 changes: 4 additions & 3 deletions apps/server/routes/userRoutes.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import express from "express";
import authController from "../controllers/authController";
import signup from "../controllers/authController";

const router = express.Router();

router.post("/signup", authController.signup);
module.exports = router;
router.post("/signup", signup);

export default router;
5 changes: 4 additions & 1 deletion apps/server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"extends": "@repo/ts-config/tsconfig.json",
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "index.ts"]
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "index.ts"],
"compilerOptions": {
"outDir": "./dist"
}
}
2 changes: 1 addition & 1 deletion apps/server/types/controller.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
interface JsonOutput {
export interface JsonOutput {
speaker: string
dialogue: string
}
4 changes: 2 additions & 2 deletions apps/server/utils/Controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createCanvas, loadImage } from "canvas";
import dotenv from "dotenv";
dotenv.config();

import "../types/controller";
import { JsonOutput } from "../types/controller";

let genAI: GoogleGenerativeAI,
engineId: string,
Expand Down Expand Up @@ -149,7 +149,7 @@ const generateImages: (
writeDialogue(person, filePath, speech, randomNum);
}

resolve(); // Resolve the promise after writing the dialogue
resolve("Promise Resolved"); // Resolve the promise after writing the dialogue

//code issue in resolve as we need 1 argument atleast!!!
});
Expand Down
Loading

0 comments on commit e05fd02

Please sign in to comment.