Skip to content

Instantly share code, notes, and snippets.

View Rajdeep-Das's full-sized avatar
:octocat:
Focusing

Rajdeep Das Rajdeep-Das

:octocat:
Focusing
View GitHub Profile
const express = require('express');
const redis = require('redis');
const app = express();
const client = redis.createClient();
app.get('/api/endpoint', (req, res) => {
const ipAddress = req.ip;
client.incr(ipAddress, (err, requestCount) => {
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Redis.OM;
using Redis.OM.Searching;
using WatchLogger.Models;
namespace WatchLogger.Helpers
{
public class RedisStackHelper
using WatchLogger;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddWatchLoggerServices(opt =>
{
opt.SetExternalDbConnString = builder.Configuration["RedisConnectionString"];
});
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.VisualBasic;
using Redis.OM;
using Redis.OM.Searching;
using System;
using WatchLogger.Helpers;
using WatchLogger.Models;
namespace WatchLogger.Controllers
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.IO;
using Redis.OM;
using System.Runtime.InteropServices;
using WatchLogger.Exceptions;
using WatchLogger.Helpers;
using WatchLogger.HostedService;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Redis.OM;
using System.Runtime.InteropServices;
using WatchLogger.Exceptions;
using WatchLogger.Helpers;
using WatchLogger.HostedService;
namespace WatchLogger
{
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Redis.OM;
using WatchLogger.Helpers;
namespace WatchLogger.HostedService
{
public class IndexCreationService : BackgroundService
using Redis.OM.Modeling;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WatchLogger.Models
{
[Document(StorageType = StorageType.Json, Prefixes = new[] { "WLog" })]
'use strict';
const e = React.createElement;
class MediumPost extends React.Component {
constructor(props) {
super(props);
this.state = {
error: null,
isLoaded: false,
@Rajdeep-Das
Rajdeep-Das / app.js
Created March 8, 2020 16:09
FireBase Cloud Function
const functions = require('firebase-functions');
const express = require('express');
const path = require('path');
// The Firebase Admin SDK to access the Firebase Realtime Database.
const admin = require('firebase-admin');
admin.initializeApp()
/* This function may break now*/
// exports.onUserCreated = functions.firestore.collection("users").onCreate((change, context)=>{
// return console.log(change);