0

I have a simple API server running on Node.js/Express like below:

server.js

const express = require('express');
const cors = require('cors');


const app = express();

var corsOptions = {
  origin: 'https://localhost:8081',
}

// middlewares
app.use(cors(corsOptions));
app.use(express.json());
app.use(express.urlencoded({ extended: true }));

// testing api
app.get('/', (req, res) => {
  res.json({message: 'hello from API'})
})

const PORT = process.env.PORT || 8080;

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

It works normally both in the browser and Postman.

Browser Postman
Browser Postman

But when I test it on Insomnia it always Server is up and running.

enter image description here

I've downloaded the newest version and reinstalling using it, but it's still not working as expected and keeps returning the Server is up and running. message.

Did I miss something or there is a configuration to resolve this problem? Thanks

VLAZ
  • 26,331
  • 9
  • 49
  • 67
Maulana Adam Sahid
  • 375
  • 2
  • 4
  • 12
  • Not really sure what anyone here can do about it. If you have a problem with a particular client, I'd suggest creating a ticket in their [issue tracker](https://github.com/Kong/insomnia/issues). That being said, this does not look reproducible and I imagine it's something specific to your environment – Phil Dec 05 '22 at 23:27

0 Answers0