Adjusted handler API

This commit is contained in:
2020-09-22 11:10:12 +10:00
parent 7f04a656c2
commit 0d245fdeb6
15 changed files with 2137 additions and 28 deletions

View File

@@ -0,0 +1,27 @@
//express for testing
const express = require('express');
const cors = require('cors');
const bodyParser = require('body-parser');
const app = express();
app.use(cors());
app.use(bodyParser.text());
//test the library
const schema = require('./schema.js');
const handler = require('./handler.js');
const sineQL = require('../source/index.js');
const sine = sineQL(schema, handler, { debug: false });
//open the end
app.post('/sineql', async (req, res) => {
const [code, result] = await sine(req.body);
res.status(code).send(result);
});
//startup
app.listen(process.env.WEB_PORT || 3100, err => {
console.log(`listening to *:${process.env.WEB_PORT || 3100}`);
});