Added body parser, better hcaptcha code, env files

master
Keith Irwin 2021-11-24 12:20:12 -07:00
parent 1e8dd543f3
commit 55dfb68fef
Signed by: ki9
GPG Key ID: DF773B3F4A88DA86
2 changed files with 6 additions and 4 deletions

View File

@ -1,10 +1,11 @@
'use strict'
require('dotenv').config()
const app = require('express')()
const express = require('express')
const {verify} = require('hcaptcha')
app.post('/', async (req, res) => {
express().use(express.json())
.post('/', async (req, res) => {
// Check token
try {
@ -13,6 +14,6 @@ app.post('/', async (req, res) => {
if (data.success === true)
console.log('success!', data)
}).listen(80, () => {
}).listen(process.env.PORT, () => {
console.log(`API started`)
})

View File

@ -4,7 +4,8 @@
"description": "API to check hCaptcha and sendmail",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
},
"author": "Keith Irwin",
"license": "MIT",