20 lines
443 B
JavaScript
20 lines
443 B
JavaScript
'use strict'
|
|
|
|
require('dotenv').config()
|
|
const express = require('express')
|
|
const {verify} = require('hcaptcha')
|
|
|
|
express().use(express.json())
|
|
.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)
|
|
|
|
}).listen(process.env.PORT, () => {
|
|
console.log(`API started`)
|
|
})
|