mailapi/index.js

20 lines
443 B
JavaScript
Raw Normal View History

2021-11-24 11:02:52 -07:00
'use strict'
2021-11-24 11:19:34 -07:00
require('dotenv').config()
const express = require('express')
2021-11-24 11:19:34 -07:00
const {verify} = require('hcaptcha')
express().use(express.json())
.post('/', async (req, res) => {
2021-11-24 11:19:34 -07:00
// 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)
2021-11-24 11:02:52 -07:00
}).listen(process.env.PORT, () => {
2021-11-24 11:02:52 -07:00
console.log(`API started`)
})