Added body parser, better hcaptcha code, env files
parent
1e8dd543f3
commit
55dfb68fef
7
index.js
7
index.js
|
@ -1,10 +1,11 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
require('dotenv').config()
|
require('dotenv').config()
|
||||||
const app = require('express')()
|
const express = require('express')
|
||||||
const {verify} = require('hcaptcha')
|
const {verify} = require('hcaptcha')
|
||||||
|
|
||||||
app.post('/', async (req, res) => {
|
express().use(express.json())
|
||||||
|
.post('/', async (req, res) => {
|
||||||
|
|
||||||
// Check token
|
// Check token
|
||||||
try {
|
try {
|
||||||
|
@ -13,6 +14,6 @@ app.post('/', async (req, res) => {
|
||||||
if (data.success === true)
|
if (data.success === true)
|
||||||
console.log('success!', data)
|
console.log('success!', data)
|
||||||
|
|
||||||
}).listen(80, () => {
|
}).listen(process.env.PORT, () => {
|
||||||
console.log(`API started`)
|
console.log(`API started`)
|
||||||
})
|
})
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
"description": "API to check hCaptcha and sendmail",
|
"description": "API to check hCaptcha and sendmail",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"start": "node index.js"
|
||||||
},
|
},
|
||||||
"author": "Keith Irwin",
|
"author": "Keith Irwin",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
Loading…
Reference in New Issue