Skip to content

Instantly share code, notes, and snippets.

@raddeus
raddeus / App.js
Created April 4, 2020 06:14
React ReCAPTCHA v3
import React, { useEffect, useState } from 'react';
// Set this to your public ReCAPTCHA client key
const RECAPTCHA_SITE_KEY = 'YOUR_KEY_HERE';
// Set this to your backend URL that verifies ReCAPTCHA tokens
const RECAPTCHA_VERIFY_URL = 'http://www.mocky.io/v2/5e88253631000025303f4835';
/**
* Sends a request to your server to verify the given token
// Actions
export const ADD_TOAST = "ADD_TOAST";
export const DISMISS_TOAST = "DISMISS_TOAST";
// Action Creator
export function addToast(toast) {
toast = { ...toast, id: Math.random() };
return function(dispatch) {
dispatch({
type: ADD_TOAST,
$postBody = [
'test' => 'test'
];
$baseUrl = 'http://localhost:4000';
$ch = curl_init();
curl_setopt($ch, CURLINFO_HEADER_OUT, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
@raddeus
raddeus / app.js
Last active September 14, 2024 17:23
Basic Express 4.0 Setup with connect-flash
var express = require('express');
var session = require('express-session');
var cookieParser = require('cookie-parser');
var flash = require('connect-flash');
var app = express();
app.use(cookieParser('secret'));
app.use(session({cookie: { maxAge: 60000 }}));
app.use(flash());