Added dotenv and hcaptcha
parent
75fb52e79e
commit
1e8dd543f3
13
index.js
13
index.js
|
@ -1,9 +1,18 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
|
require('dotenv').config()
|
||||||
const app = require('express')()
|
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, () => {
|
}).listen(80, () => {
|
||||||
console.log(`API started`)
|
console.log(`API started`)
|
||||||
})
|
})
|
||||||
|
|
|
@ -81,6 +81,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
|
||||||
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
|
"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": {
|
"ee-first": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
"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",
|
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
||||||
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
|
"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": {
|
"http-errors": {
|
||||||
"version": "1.7.2",
|
"version": "1.7.2",
|
||||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
|
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
"author": "Keith Irwin",
|
"author": "Keith Irwin",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"express": "^4.17.1"
|
"dotenv": "^10.0.0",
|
||||||
|
"express": "^4.17.1",
|
||||||
|
"hcaptcha": "^0.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue