Last active
January 25, 2022 23:09
-
-
Save calthoff/8122f43f2bfd516c388d51ef4be21a3e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import express from 'express'; | |
import { initializeApp } from 'firebase/app'; | |
import { getDatabase, ref, set, onValue } from "firebase/database"; | |
import 'dotenv/config' | |
import { dirname } from 'path'; | |
import { fileURLToPath } from 'url'; | |
import { createRequire } from 'module' | |
const require = createRequire(import.meta.url) | |
const Vonage = require('@vonage/server-sdk') | |
var bodyParser = require('body-parser') | |
let app = express(); | |
app.use( bodyParser.json() ); | |
app.use(bodyParser.urlencoded({limit: '5000mb', extended: true, parameterLimit: 100000000000})); | |
app.use(express.static("public")); | |
const __dirname = dirname(fileURLToPath(import.meta.url)); | |
const firebaseConfig = { | |
apiKey: process.env.API_KEY, | |
authDomain: process.env.AUTH_DOMAIN, | |
projectId: process.env.PROJECT_ID, | |
storageBucket: process.env.STORAGE_BUCKET, | |
messagingSenderId: process.env.MESSAGING_SENDER_ID, | |
appId: process.env.APP_ID | |
}; | |
initializeApp(firebaseConfig); | |
const vonage = new Vonage({ | |
apiKey: process.env.API_KEY, | |
apiSecret: process.env.API_SECRET, | |
applicationId: process.env.APPLICATION_ID, | |
privateKey: process.env.PRIVATE_KEY | |
}) | |
app.post('/create/contact', function (req, res) { | |
set(ref(getDatabase(), 'users/' + req.body.name), { | |
number: req.body.number, | |
}); | |
res.redirect('/') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment