diff --git a/api/routes/stream.ts b/api/routes/stream.ts index 2f270b4..9151e43 100644 --- a/api/routes/stream.ts +++ b/api/routes/stream.ts @@ -2,7 +2,7 @@ import axios from 'axios' import { Request, Response } from 'express' import getAudioStreamDetails from '../lib/getAudioStreamDetails' -export async function stream(req: Request, res: Response) { +export default async function stream(req: Request, res: Response) { const id = req.params.ytid const streamDef = await getAudioStreamDetails(id, 'audio/webm') const response = await axios.get(streamDef.url, { responseType: 'stream' }) diff --git a/api/server.ts b/api/server.ts index 71cf691..fcb10dd 100644 --- a/api/server.ts +++ b/api/server.ts @@ -5,9 +5,10 @@ import pkg from '../package.json' assert { type: 'json' } import cors from 'cors' // @ts-ignore import sendSeekable from 'send-seekable' -import { stream } from './routes/stream' +import stream from './routes/stream' import download from './routes/download' import autocomplete from './routes/autocomplete' +import search from './routes/search' import stoppable from 'stoppable' const app = express() @@ -27,6 +28,7 @@ app.get('/api', (_, res) => { app.get('/api/stream/:ytid', stream) app.get('/api/dl/:ytid', download) app.get('/api/autocomplete', autocomplete) +app.get('/api/search', search) const PORT = Number(process.env.PORT || 3000)