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
import { Application } from "express"; | |
import { UserController } from "../controllers/UserController"; | |
import { validatePost } from "../middlewares/validators/userValidator"; | |
export default function userRoutes(app: Application) { | |
const controller = new UserController(); | |
app.post( | |
"/user", | |
validatePost(), |
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
import { pool } from "database"; | |
export class UserService{ | |
public create(data: ICreateUserData){ | |
return pool.query(`INSERT...`); | |
} | |
} |
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
import { Request, Response } from "express"; | |
import { validationResult } from "express-validator"; | |
import { UserService } from "../services/UserService"; | |
export class UserController { | |
service: UserService; | |
constructor(){ | |
this.service = new UserService(); | |
} |
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
import moment from "moment"; | |
import { CacheProperties } from "../../@types/Cache"; | |
export default class CacheService { | |
public set(key: string, value: string, validityInMinutes: number = 0): boolean { | |
try { | |
const properties: CacheProperties = { | |
key, | |
value, | |
createdAt: moment().format(), |
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
# BEFORE | |
const response = await groqClient.chat.completions.create({ | |
messages: [ | |
// Your messages here | |
], | |
model: "your-model", | |
response_format: { | |
type: "json_object" | |
} | |
}); |
OlderNewer