IO-2327 job importing test cases

This commit is contained in:
swtmply
2023-07-21 04:25:53 +08:00
parent 6562fd57df
commit 835b90bc4b
16 changed files with 9536 additions and 51 deletions

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

@@ -0,0 +1,24 @@
const GraphQLClient = require("graphql-request").GraphQLClient;
exports.testQuery = async function (req, res) {
const BearerToken = req.headers.authorization;
const { query, ...rest } = req.body;
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {
headers: {
Authorization: BearerToken,
},
});
try {
const result = await client
.setHeaders({ Authorization: BearerToken })
.request(query, {
...rest,
});
res.status(200).json(result);
} catch (error) {
res.status(400).send(JSON.stringify(error));
}
};