From 900485acb9ab6f62486d1198835bb6759e78345b Mon Sep 17 00:00:00 2001 From: Ashley Date: Mon, 15 Aug 2022 11:58:08 +0200 Subject: [PATCH] Update 'p/server.js' --- p/{server.js => server.js} | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) rename p/{server.js => server.js} (86%) diff --git a/p/server.js b/p/server.js similarity index 86% rename from p/server.js rename to p/server.js index d8dd59ef..d8172ba7 100644 --- a/p/server.js +++ b/p/server.js @@ -1,7 +1,8 @@ -const fs = require("fs"); + const fs = require("fs"); const express = require("express"); const fetch = require("node-fetch"); const htmlParser = require("node-html-parser"); +const lyrics = require("./lyrics.js"); const app = express(); @@ -43,6 +44,17 @@ const listener = (req, res) => { }; app.get("/", (req, res) => res.redirect(`/https://www.google.com/`)); + + +app.get("/api/lyrics", async (req, res) => { + const query = req.query.query; + + res.json(await lyrics(query)) + +}); + + app.all("/*", listener); app.listen(3000, () => {}); +