URL shortener - help needed

I’m quite new to Node. I’ve been working on the URL shortener project, but I haven’t understood how to achieve this process. I have managed to use the post method to save new entries and retrieve existing URLs but I’m confused with the concept of redirecting a page and where to do it.
I see some solutions only using .get() but I don’t understand how is that achieved while the user is POSTING a string; so shouldn’t there be a .post() method instead of .get()?

here is the code that I wrote:

ar express = require('express');
var mongo = require('mongodb');
var mongoose = require('mongoose');
const bodyParser = require('body-parser');
const validURL = require('valid-url');
const dns = require('dns');
var cors = require('cors');

var app = express();
var _id = 0;

// Basic Configuration 
var port = process.env.PORT || 3000;

/** this project needs a db !! **/ 
mongoose.connect(process.env.MONGOLAB_URI);
const Schema = mongoose.Schema;
var count = 0;
var urlSchema = new Schema(
  {
    url: {
      type: String,
      required: true
         },
    id: {
      type: Number,
      required: true
        }
  });

var UrlModel = mongoose.model('UrlModel', urlSchema);

app.use(cors());
app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());

app.use('/public', express.static(process.cwd() + '/public'));

app.get('/', function(req, res){
  res.sendFile(process.cwd() + '/views/index.html');
});

  
// your first API endpoint... 
app.get("/api/hello", function (req, res) {
  res.json({greeting: 'hello API'});
});

var count = 0;
app.post('/api/shorturl/new', (req, res) => {
  var frmtURL = req.body.url.replace(/(^\w+:|^)\/\//, '');
  
    if (validURL.isUri(req.body.url)) {
    UrlModel.findOne({"url": req.body.url}, (err, data) => {
      if (err) return console.log("findOne err");
      if (data) {
        res.send({"original_url": data.url, "short_url": data.id});
      }
      else {
        var newRec;
        UrlModel.find({}, (err, data) => { 
          count = data.length++;          
          console.log('count 1: '+count);
          newRec = new UrlModel({"url": req.body.url, "id": count});
          newRec.save((err, data) => {
            if (err) console.log("error saving");
            console.log("new rec saved");
          });
          res.send({"original_url": req.body.url, "short_url": count});
        });
      }
    });
  }
  else {
    res.send({"error": "invalide URL"});
    console.log("invalid URL");  
  }
});

app.listen(port, function () {
  console.log('Node.js listening ...');
});