Added dotenv and hcaptcha

master
Keith Irwin 2021-11-24 11:19:34 -07:00
parent 75fb52e79e
commit 1e8dd543f3
Signed by: ki9
GPG Key ID: DF773B3F4A88DA86
3 changed files with 24 additions and 3 deletions

View File

@ -1,9 +1,18 @@
'use strict'
require('dotenv').config()
const app = require('express')()
const {verify} = require('hcaptcha')
app.post('/', async (req, res) => {
// Check token
try {
const data = await verify(process.env.HCAPTCHA_SECRET, req.body['token'])
} catch (err) { console.error(err) }
if (data.success === true)
console.log('success!', data)
app.post('/', (req, res) => {
res.send('Hello World')
}).listen(80, () => {
console.log(`API started`)
})

10
package-lock.json generated
View File

@ -81,6 +81,11 @@
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
},
"dotenv": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz",
"integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q=="
},
"ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
@ -162,6 +167,11 @@
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
},
"hcaptcha": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/hcaptcha/-/hcaptcha-0.1.0.tgz",
"integrity": "sha512-mVRkhNcOuP7QJO50nYdu3vS+uaOg6Ku2HpMy50C2EckjB9DlnwX24iePi912IXuVIq5L8ukjISG4Ea6MimZ5+w=="
},
"http-errors": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",

View File

@ -9,6 +9,8 @@
"author": "Keith Irwin",
"license": "MIT",
"dependencies": {
"express": "^4.17.1"
"dotenv": "^10.0.0",
"express": "^4.17.1",
"hcaptcha": "^0.1.0"
}
}