-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
32 lines (25 loc) · 773 Bytes
/
Copy pathindex.ts
File metadata and controls
32 lines (25 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import express from 'express'
import createProof from './createProof';
const app: express.Express = express()
app.use(express.json())
app.use(express.urlencoded({ extended: true }))
//CORS対応(本番環境では見直し)
app.use((req: express.Request, res: express.Response, next: express.NextFunction) => {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Methods", "*")
res.header("Access-Control-Allow-Headers", "*");
next();
})
app.listen(3000, () => {
console.log("Start on port 3000.")
})
app.post('/create_vc', async function(req, res) {
const proof = await createProof(
req.body.pk,
req.body.sk,
req.body.messages,
);
res.json({
"proof": proof
});
})