Skip to content

Instantly share code, notes, and snippets.

View puuble's full-sized avatar

marian ivanov puuble

  • full stack backend
  • Bulgaria
View GitHub Profile
@puuble
puuble / f1_config.js
Last active January 30, 2023 15:14
multiple database structure by schema
//database/config.js
const mongoose = require('mongoose');
class Database {
constructor(options) {
this.options = options;
this.connect();
}
connect() {
@puuble
puuble / webhook.php
Last active February 17, 2023 00:17
Posentegra Help
<?php
//webhook olarak vereceginiz URL icerisinde su sekilde bizden veri alabilirsiniz.
try {
// gelen datayi aliyoruz
$requestPayload = file_get_contents('php://input');
// JSON objectini decode ediyoruz.
$payload = json_decode($requestPayload);
@puuble
puuble / order.php
Last active February 17, 2023 00:45
Posentegra Help - Order
<?php
/*
* Siparisler uzerinden islem yapmak icin PUT methoduyla ilgili URL tetiklenirken asagidaki sekilde gerekli fieldlari gonderebilirsiniz
* asagidaki ornekte trendyol uzerinde yapilacak islemlerin ornekleri bulunmaktadir.
*/
<?php
$curl = curl_init();
@puuble
puuble / f1_index.js
Last active February 23, 2023 18:22
lambda and cloudwatch trigger
const MongoClient = require('mongodb').MongoClient;
const { Client } = require('@elastic/elasticsearch');
const uri = 'mongodb://localhost:27017/mydb';
const dbName = 'mydb';
const collectionName = 'mycollection';
const elasticUrl = 'http://localhost:9200';
const indexName = 'myindex';
exports.handler = async function(event, context) {
@puuble
puuble / app.js
Last active February 23, 2023 18:54
React for Elastic Search
/// npm install @elastic/elasticsearch
import { Client } from '@elastic/elasticsearch';
const client = new Client({
node: 'https://your-elastic-search-endpoint',
auth: {
username: 'your-username',
password: 'your-password'
}
});
@puuble
puuble / worker.js
Created February 24, 2023 12:10
worker
require("dotenv").config();
const axios = require("axios");
async function postData(url, res) {
try {
const options = {
url,
method: "POST",
headers: {"Content-Type": "application/json"},
data: res.body,
};