Within pages/api folder of your root directory for your Next.js app, create a folder called replicate.
const getPredictions = async (req, res) => {
const response = await fetch("https://api.replicate.com/v1/predictions", {
method: "POST",
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const nodemailer = require('nodemailer'); | |
const app = express(); | |
const path = require('path'); | |
const dotenv = require('dotenv'); | |
dotenv.config(); | |
app.use(express.static('public')); |
// To use the AWS SDK, first import it from aws-sdk npm package | |
import AWS from 'aws-sdk'; | |
const s3Bucket = `__your_aws_s3_bucket_name__`; | |
const region = `__your_aws_region_name__`; | |
const urlExpirationTime = `__your_aws_s3_url_expiration_time__` | |
AWS.config.update({ | |
accessKeyId: `__your_aws_access_key_id__`, | |
secretAccessKey: `__your_aws_secret_access_key__`, |
// Create a file, say, User.js(basically this file keeps all the configurations and setup for initializing User table in the database) | |
// Sequelize is an ORM, right? | |
// So, you don't need to learn SQL to use MySQL, that's what we will do below: | |
// Import Sequelize from sequelize npm package | |
const {Sequelize, DataTypes} = require("sequelize"); | |
const sequelize = new Sequelize( | |
'__your_db_name__', | |
'__your_db_password__', | |
{ |
// Import bcrypt from bcrypt npm package | |
const bcrypt = require("bcrypt); | |
// Hash the incoming password using bcyrpt | |
// Use it during SIGNUP, thus save the hashed password only in Database | |
async function hashPassword(plaintextPassword) { | |
const hashedPassword = await bcrypt.hash(plaintextPassword, 10); | |
// Now store it in the database instead of plainText password | |
} | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Google reCaptcha Example</title> | |
<meta charset="utf-8″> | |
<meta name="viewport" content="width=device-width, initial-scale=1″> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> |
<?php | |
error_reporting(0); | |
if (isset($_POST[‘submit’]) && !empty($_POST[‘submit’])) { | |
if (isset($_POST[‘g-recaptcha-response’]) && !empty($_POST[‘g-recaptcha-response’])) { | |
$secret = ‘__your_secret_key__’; | |
$captchaResponse = file_get_contents(‘https://www.google.com/recaptcha/api/siteverify?secret=’ . $secret . ‘&response=’ . $_POST[‘g-recaptcha-response’]); | |
$responseData = json_decode($captchaResponse ); | |
if ($responseData->success) { | |
$name = !empty($_POST[‘name’]) ? $_POST[‘name’] : ”; |
import requests
headers = {
'Authorization': 'Bearer <__jwt__>',
'Content-Type': 'application/json',
'Accept': 'application/json',
'User-Agent': 'demoApp/1.0',
'X-Snowflake-Authorization-Token-Type': '<__keyPair_JWT__>',
}