I am working on a project where I create a simple CRUD in express. I am trying to use the `express.Router()` to send the form data using the HTTP `POST` method. Here is how the form looks like on the browser:

[form.png](https://i.stack.imgur.com/VHO4q.png)

It was errorless throughout, but when i filled out the form and clicked on the "submit" button, It displayed this message on the browser:

```
Cannot POST '/login'

```

Here is my `server.js` file (configuration file):

```js
// variables
var express = require('express');
var path = require('path');
var router = require('./routes/router');
var app = express();
var port = process.env.PORT || 3000;

// static files
app.use(express.static(path.join(__dirname, 'public')));
app.use('/login', router);

// setting the view engine
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'pug');

// Create the paths
app.get('/', (req, res) => {
    res.render('index', { title : "Hello world" });
});
app.get('/login', (req, res) => {
    res.render('login');
});

// deploy the app
app.listen(port, function() {
    console.log(`Server is listening on port ${port}`);
});

```

Here is my `router.js` file (`./routes/router`):

```js
var express = require('express');
var router = express.Router();

router.post('/login', (req, res) => {
    res.json(req.body);
});

module.exports = router;

```

Here is my `login.pug` file:

```
doctype html
html(lang="en")
    head
        meta(charset="UTF-8")
        meta(name="viewport", content="width=device-width, initial-scale=1.0")
        title Details
    body
        h1 Details
        p Please fill out this form 
        form(action="/", method="POST")
            label(for="fname") First Name:
            input(type="text", name="fname", id="fname")
            label(for="lname") Last Name:
            input(type="text", name="lname", id="lname")
            button(type="submit") Submit

```

And here is how my folder's structure looks like:

```
│─ node_modules
│─ routes
│ └─ router.js
│─ views
│ │─ index.pug
│ └─ login.pug
│─ package-lock.json
│─ package.json
│─ server.js

```

Can someone explain to me as to what am I doing wrong here or is there some issue with one of the files mentioned above?