Skip to content

Commit

Permalink
Create quantum-computing.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Jul 22, 2024
1 parent 72ca109 commit b4ba87a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions routes/quantum-computing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import express from 'express';
import * as Qiskit from 'qiskit';

const router = express.Router();
const { QuantumCircuit, execute } = Qiskit;

router.post('/run-quantum-circuit', async (req, res) => {
const { circuitData } = req.body;
const circuit = new QuantumCircuit(circuitData);
const job = await execute(circuit, 'ibmq_qasm_simulator');
const result = await job.result();
res.json({ result });
});

export default router;

0 comments on commit b4ba87a

Please sign in to comment.