forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
route.js
26 lines (23 loc) · 816 Bytes
/
route.js
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
import { useCases, notUsingEval, usingEval } from '../../lib/utils'
import {
usingWebAssemblyCompile,
usingWebAssemblyInstantiate,
usingWebAssemblyInstantiateWithBuffer,
} from '../../lib/wasm'
export default async function handler(request) {
const useCase = request.nextUrl.searchParams.get('case')
return Response.json(
useCase === useCases.eval
? await usingEval()
: useCase === useCases.noEval
? await notUsingEval()
: useCase === useCases.wasmCompile
? await usingWebAssemblyCompile(9)
: useCase === useCases.wasmInstanciate
? await usingWebAssemblyInstantiate(9)
: useCase === useCases.wasmBufferInstanciate
? await usingWebAssemblyInstantiateWithBuffer(9)
: { ok: true }
)
}
export const config = { runtime: 'experimental-edge' }