Added body parser, better hcaptcha code, env files
parent
1e8dd543f3
commit
55dfb68fef
7
index.js
7
index.js
|
@ -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`)
|
||||
})
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue