Skip to content

Commit

Permalink
(Func): Support body
Browse files Browse the repository at this point in the history
  • Loading branch information
kang49 committed Jan 29, 2024
1 parent 1f30b99 commit 907bbe0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,4 @@ dist
.DS_Store
assets/cache
package-lock.json
*.lock
6 changes: 5 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ app.use((req, res, next) => {

// API Route
app.get(/\/api$/, async (req, res) => {
const { biliLink } = req.query;
const { biliLink } = req.body.biliLink ?? req.query;

// Convert to string
var BiliLink = biliLink?.toString() || '';
Expand Down Expand Up @@ -70,6 +70,10 @@ app.get(/\/ping$/, async (req, res) => {
res.send('pong');
});

app.get('/', async (req, res) => {
res.send('Welcome to Bilibili Story Builder API');
});

// Start the server
app.listen(port, () => {
console.log(`Server is running on port ${port}`);
Expand Down

0 comments on commit 907bbe0

Please sign in to comment.