Make Server in BAS , like Node Express Server

Support
  • i wan to to try make server , in BAS to direct receive post and get request,
    Following is my Code.

    const express = require('express');
    var session = require('express-session');
    const bodyParser = require('body-parser');
    const app = express();
    const port = 3000;
    app.use(bodyParser.json());

    app.post('/next', async (req, res) => {
    res.header('Access-Control-Allow-Origin', '*'); // Allow requests from any origin
    res.header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE');
    res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization');

    aiValue = req.body.ai;
        prValue = req.body.pr;
       [[EMAIL]]    =  req.body.ai;
       [[PASSWORD]] =  req.body.pr;

      await BAS_FUNCTION(
    "browserstart", 
    { email : [[EMAIL]] ,password : [[PASSWORD]] }
    

    )
       console.log("Email = > " + aiValue );
       res.send("Email : " +  [[EMAIL]] + "\n"+"Password : " + [[PASSWORD]]);
    });
    app.listen(port, () => {
    console.log(App listening on port ${port})
    });

    I add Node module and this code write this in Node module in BAS.

    i have problem when send post to , it not call functions.
    please help me.

    Thank you

  • @saimraza786 why just not to run node js server not in BAS? set 2 endpoint url's, one to push data on server , and second to retrieve data from server to BAS only by GET request?

  • Remote node library issue

    Support
    0 Votes
    1 Posts
    328 Views
  • BAS

    Support
    0 Votes
    5 Posts
    616 Views
  • 0 Votes
    3 Posts
    712 Views
  • Get BAS Script username

    Support
    0 Votes
    3 Posts
    801 Views
  • 0 Votes
    1 Posts
    660 Views