Form Submit redirects to about:blank#blocked in ExpressJS

Viewed 728

I've been trying to make an app that fetches information about anime from a third-party-API. I've designed the form and the server.js file but when I submit the form, for some reason it redirects to about:blank#blocked instead of its intended location.

Here's the code

main.js

const Jikan = require('jikan-node')
const express = require('express')
const path = require('path')
const bodyParser = require('body-parser')
const mal = new Jikan()

app = express()
app.use(express.urlencoded())
app.use(express.static(path.join(__dirname, 'views')));

app.get('/', (req, res) => {
    res.sendFile('index.html', {
        root: path.join(__dirname, './views/')
    })
})

app.post('/find', (req, res) => {
    res.send(req.body.animeName)
})

app.listen(3000, (req, res) => console.log("Server Running on 127.0.0.1:3000"))

index.html

...
<div class="container">
    <h3>Anime Lookup</h3>
    <form  method="POST" action="https://127.0.0.1:3000/find">
        <div class="form">
                <input type="text" name="animeName" placeholder="Anime Name"><input type="submit" value="Search">
        </div>
    </form>
</div>
...
0 Answers
Related