Skip to content

Instantly share code, notes, and snippets.

View asror797's full-sized avatar

Asrorbek Shakhobiddinov asror797

View GitHub Profile

Asrorbek Shakhobiddinov

Node.js Backend Developer

Gmail | Linkedin | Github

Building pixel perfect apps for 1 billion people. Areas: social network, delivery, finance, logistics.

EXPERIENCE

@asror797
asror797 / buttons.ts
Created February 17, 2024 15:35
Telegraf.js
const { Markup, Extra } = require('telegraf');
Extra.markup(Markup.inlineKeyboard([
[
Markup.callbackButton('name button', 'data_button'),
Markup.callbackButton('another button', 'data_button'),
],
[
Markup.callbackButton('next row button', 'data_button')
],
@asror797
asror797 / prisma.module.ts
Last active February 17, 2024 15:25
Nest.js and Prisma
import { Module } from "@nestjs/common";
import { PrismaService } from "./prisma.service";
@Module({
providers: [PrismaService],
exports: [PrismaService]
})
export class PrismaModule {}
@asror797
asror797 / task.controller.ts
Created February 17, 2024 15:05
TaskController manages HTTP requests for tasks, logging with APILogger
import { APILogger } from '../logger/api.logger';
import { TaskService } from '../service/task.service';
export class TaskController {
private taskService: TaskService;
private logger: APILogger;
constructor() {
this.taskService = new TaskService();
@asror797
asror797 / main.ts
Last active February 17, 2024 14:53
Bootstrap a NestJs application with CORS enabled
import { INestApplication } from '@nestjs/common'
import { NestFactory } from '@nestjs/core'
import { App } from './app'
setImmediate(async (): Promise<void> => {
const app = await NestFactory.create<INestApplication>(App, {
cors: true,
})
await app.listen(3000)
@asror797
asror797 / fetch-data-client.js
Last active February 17, 2024 14:43
Fetch data client function for SQL queries
const Fetch = async(SQL, ...params) => {
try {
const client = await pool.connect()
const { rows } = await client.query(SQL,params.length ? params : null)
return rows
} finally {
client.release()
}
}