Skip to content

Instantly share code, notes, and snippets.

@apemon
Created June 25, 2020 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apemon/6c6d3aa64d9f0e413a52af08c0cb6771 to your computer and use it in GitHub Desktop.
Save apemon/6c6d3aa64d9f0e413a52af08c0cb6771 to your computer and use it in GitHub Desktop.
Stupid-Hack API
const express = require('express');
const bodyParser = require('body-parser');
const mysql = require('mysql');
const config = {
host: '157.230.243.208',
user: 'rathena',
password: 'P@ssw0rd#123',
database: 'rathena'
};
const conn = mysql.createConnection(config);
const app = express();
app.use(bodyParser.json());
app.get('/', (req,res) => {
res.send('hello world');
});
app.post('/command', (req,res) => {
var body = req.body;
const sql = `INSERT INTO \`cp_commands\` (\`command\`, \`issuer\`, \`account_id\`, \`done\`, \`timestamp\`) VALUES ('${body.command}', '${body.issuer}', '${body.account_id}', 0, NULL);`
console.log(sql);
conn.query(sql);
res.sendStatus(204);
});
app.listen(8888, () => {
console.log('application start');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment