Rearranged the files, adjusted the code slightly

This commit is contained in:
2020-09-19 09:03:55 +10:00
parent 1addf15a39
commit 6b7e55c05f
9 changed files with 48 additions and 73 deletions

24
test-server/server.js Normal file
View File

@@ -0,0 +1,24 @@
//express for testing
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
app.use(bodyParser.text());
//test the library
const schema = require('./schema.js');
const handler = require('./handler.js');
const sineQL = require('../index.js');
const sine = sineQL(schema, handler);
//open the end
app.post('/simpleql', 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}`);
});