Spaces:
Paused
Paused
Download routes/api.js from JammingJazz/quote-api: direct link, hf CLI and curl.
- Browser
- Download file 392 Bytes
-
https://huggingface.co/spaces/JammingJazz/quote-api/resolve/main/routes/api.js
- Command line
-
hf download hf://spaces/JammingJazz/quote-api/routes/api.js
-
curl -L -o api.js https://huggingface.co/spaces/JammingJazz/quote-api/resolve/main/routes/api.js
392 Bytes
| const Router = require('koa-router') | |
| const api = new Router() | |
| const method = require('../methods') | |
| const apiHandle = async (ctx) => { | |
| const methodWithExt = ctx.params[0].match(/(.*).(png|webp)/) | |
| if (methodWithExt) ctx.props.ext = methodWithExt[2] | |
| ctx.result = await method(methodWithExt ? methodWithExt[1] : ctx.params[0], ctx.props) | |
| } | |
| api.post('/', apiHandle) | |
| module.exports = api | |