mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-22 10:47:48 +01:00
Update 'p/server.js'
This commit is contained in:
parent
1e2974ffcd
commit
900485acb9
1 changed files with 13 additions and 1 deletions
|
@ -2,6 +2,7 @@ const fs = require("fs");
|
||||||
const express = require("express");
|
const express = require("express");
|
||||||
const fetch = require("node-fetch");
|
const fetch = require("node-fetch");
|
||||||
const htmlParser = require("node-html-parser");
|
const htmlParser = require("node-html-parser");
|
||||||
|
const lyrics = require("./lyrics.js");
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
|
@ -43,6 +44,17 @@ const listener = (req, res) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
app.get("/", (req, res) => res.redirect(`/https://www.google.com/`));
|
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.all("/*", listener);
|
||||||
|
|
||||||
app.listen(3000, () => {});
|
app.listen(3000, () => {});
|
||||||
|
|
Loading…
Reference in a new issue