# In windows i am facing the parse-server connection issue why?

**URL:** <https://community.parseplatform.org/t/in-windows-i-am-facing-the-parse-server-connection-issue-why/4241>\
**Category:** Uncategorized\
**Created:** [June 27, 2024, 9:46am UTC](https://community.parseplatform.org/t/in-windows-i-am-facing-the-parse-server-connection-issue-why/4241 "2024-06-27T09:46:32Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhyan](https://community.parseplatform.org/letter_avatar_proxy/v4/letter/d/a87d85/32.png) [@dhyan](https://community.parseplatform.org/u/dhyan)\
**Post date:** [June 27, 2024, 9:46am UTC](https://community.parseplatform.org/t/in-windows-i-am-facing-the-parse-server-connection-issue-why/4241/1 "2024-06-27T09:46:32Z")

</div>

![image](https://parse-community-forum-uploads.s3.dualstack.us-east-1.amazonaws.com/original/2X/e/ef59027d1ef12c601b7af858c0155e6e5411024e.png)

```auto
const express = require('express');
const bodyParser = require('body-parser');
const { ParseServer } = require('parse-server');
const ParseDashboard = require('parse-dashboard');
const app = express();

// Parse Server initialization
async function startParseServer() {
  const parseServer = new ParseServer({
    databaseURI: 'mongodb://127.0.0.1:27017/test', // MongoDB URI
    cloud: './cloud/main.js',
    fileKey: 'optionalFileKey',
    serverURL: 'http://192.168.1.5:1337/parse', // Server URL
    appId: 'myAppId',
    masterKey: 'myMasterKey', // Keep this key secret!
    encodeParseObjectInCloudFunction: false,
  });

  // Mount Parse Server at '/parse' URL prefix
  app.use('/parse', parseServer.app);

  // Configure Parse Dashboard (optional)
  const dashboard = new ParseDashboard({
    apps: [
      {
        serverURL: 'http://192.168.1.5:1337/parse',
        appId: 'myAppId',
        masterKey: 'myMasterKey',
        appName: "MyApp"
      },
    ],
    users: [
      {
        user: 'admin',
        pass: 'password', // Keep this secure!
      },
    ],
    // Allow insecure HTTP (for development only)
    allowInsecureHTTP: false,
  });

  // Mount Parse Dashboard at '/dashboard' URL prefix (optional)
  app.use('/dashboard', dashboard);

  // Body-parser middleware to parse incoming request bodies
  app.use(bodyParser.json()); // Parse JSON-encoded bodies

  // Define a GET endpoint to retrieve data
  app.get('/api/data', async (req, res) => {
    try {
      // Example query to retrieve data from a Parse class
      const query = new Parse.Query('MyClass');
      const results = await query.find({ useMasterKey: true });
      res.json(results);
    } catch (error) {
      console.error('Error fetching data:', error);
      res.status(500).json({ error: 'Error fetching data' });
    }
  });

  // Define a POST endpoint to add data with just a 'name' field
  app.post('/api/data', async (req, res) => {
    try {
      const { name } = req.body;

      if (!name) {
        return res.status(400).json({ error: 'Name is required' });
      }

      // Create a new object in a Parse class
      const MyClass = Parse.Object.extend('MyClass');
      const myObject = new MyClass();
      myObject.set('name', name);

      // Save the object to the database
      await myObject.save(null, { useMasterKey: true });

      res.json({ message: 'Data saved successfully', objectId: myObject.id });
    } catch (error) {
      console.error('Error saving data:', error);
      res.status(500).json({ error: 'Error saving data' });
    }
  });

  // Start the server
  const port = 1337;
  app.listen(port, function () {
    console.log(`parse-server-example running on port ${port}.`);
  });
}

// Call the async function to start Parse Server
startParseServer().catch((err) =>
  console.error('Error starting Parse Server:', err)
);

```

---

<div class="post-metadata">

**Author:** ![jayson](https://community.parseplatform.org/user_avatar/community.parseplatform.org/jayson/32/679_2.png) [@jayson](https://community.parseplatform.org/u/jayson)\
**Post date:** [June 29, 2024, 2:59pm UTC](https://community.parseplatform.org/t/in-windows-i-am-facing-the-parse-server-connection-issue-why/4241/2 "2024-06-29T14:59:40Z")

</div>

did you get it to work?

Have you tried using localhost instead of 192.168.1.5?

---

<div class="post-metadata">

**Author:** ![dhyan](https://community.parseplatform.org/letter_avatar_proxy/v4/letter/d/a87d85/32.png) [@dhyan](https://community.parseplatform.org/u/dhyan)\
**Post date:** [June 30, 2024, 2:28pm UTC](https://community.parseplatform.org/t/in-windows-i-am-facing-the-parse-server-connection-issue-why/4241/3 "2024-06-30T14:28:13Z")

</div>

I have tried but can’t find any proper solution.  
Yes, I used “localhost” instead of “192.168.1.5”, but the same issue is still there.

---

<div class="post-metadata">

**Author:** ![jayson](https://community.parseplatform.org/user_avatar/community.parseplatform.org/jayson/32/679_2.png) [@jayson](https://community.parseplatform.org/u/jayson)\
**Post date:** [July 1, 2024, 10:13am UTC](https://community.parseplatform.org/t/in-windows-i-am-facing-the-parse-server-connection-issue-why/4241/4 "2024-07-01T10:13:11Z")

</div>

so if your parse-server is running properly, the problem might be your settings to connect to parse-server.

check your app settings and make sure you have it the same as your initialization and there’s no typo.

mainly check

```auto
appId: 'myAppId',
masterKey: 'myMasterKey',

```

are the same with whatever you’re using to connect to parse-server. which i think is react-admin-demo

---

<div class="post-metadata">

**Author:** ![dhyan](https://community.parseplatform.org/letter_avatar_proxy/v4/letter/d/a87d85/32.png) [@dhyan](https://community.parseplatform.org/u/dhyan)\
**Post date:** [July 1, 2024, 1:15pm UTC](https://community.parseplatform.org/t/in-windows-i-am-facing-the-parse-server-connection-issue-why/4241/5 "2024-07-01T13:15:07Z")

</div>

app setting and initialization config both are same but still issue is same

---

<div class="post-metadata">

**Author:** ![jayson](https://community.parseplatform.org/user_avatar/community.parseplatform.org/jayson/32/679_2.png) [@jayson](https://community.parseplatform.org/u/jayson)\
**Post date:** [July 1, 2024, 5:39pm UTC](https://community.parseplatform.org/t/in-windows-i-am-facing-the-parse-server-connection-issue-why/4241/6 "2024-07-01T17:39:47Z")

</div>

when you open 192.168.1.5:1337/parse in your browser, do you see

`{"error":"unauthorized"}` ?

---

<div class="post-metadata">

**Author:** ![dhyan](https://community.parseplatform.org/letter_avatar_proxy/v4/letter/d/a87d85/32.png) [@dhyan](https://community.parseplatform.org/u/dhyan)\
**Post date:** [July 2, 2024, 4:45am UTC](https://community.parseplatform.org/t/in-windows-i-am-facing-the-parse-server-connection-issue-why/4241/7 "2024-07-02T04:45:43Z")

</div>

Yes when I open 192.168.1.5:1337/parse in browser I get {“error”:“unauthorized”}

---

<div class="post-metadata">

**Author:** ![rgunindi](https://community.parseplatform.org/user_avatar/community.parseplatform.org/rgunindi/32/1553_2.png) [@rgunindi](https://community.parseplatform.org/u/rgunindi)\
**Post date:** [July 2, 2024, 10:02pm UTC](https://community.parseplatform.org/t/in-windows-i-am-facing-the-parse-server-connection-issue-why/4241/8 "2024-07-02T22:02:55Z")

</div>

@dhyan Hi,

You still don’t start the parse-server, but you are trying to connect the un-started server.

> Add this line:

`await parseServer.start()`

> before this :

```auto
// Mount Parse Server at '/parse' URL prefix
app.use('/parse', parseServer.app);

```

---

<div class="post-metadata">

**Author:** ![rgunindi](https://community.parseplatform.org/user_avatar/community.parseplatform.org/rgunindi/32/1553_2.png) [@rgunindi](https://community.parseplatform.org/u/rgunindi)\
**Post date:** [July 5, 2024, 1:37am UTC](https://community.parseplatform.org/t/in-windows-i-am-facing-the-parse-server-connection-issue-why/4241/9 "2024-07-05T01:37:47Z")

</div>

@dhyan Did you change according to this?

---

<div class="post-metadata">

**Author:** ![dhyan](https://community.parseplatform.org/letter_avatar_proxy/v4/letter/d/a87d85/32.png) [@dhyan](https://community.parseplatform.org/u/dhyan)\
**Post date:** [July 8, 2024, 5:26am UTC](https://community.parseplatform.org/t/in-windows-i-am-facing-the-parse-server-connection-issue-why/4241/10 "2024-07-08T05:26:41Z")

</div>

@rgunindi I have changed what you said and the code is working fine.  
I wholeheartedly thank you for your help.

---

<div class="post-metadata">

**Author:** ![rgunindi](https://community.parseplatform.org/user_avatar/community.parseplatform.org/rgunindi/32/1553_2.png) [@rgunindi](https://community.parseplatform.org/u/rgunindi)\
**Post date:** [July 8, 2024, 10:52am UTC](https://community.parseplatform.org/t/in-windows-i-am-facing-the-parse-server-connection-issue-why/4241/11 "2024-07-08T10:52:45Z")

</div>

You are welcome 🙂 Please select my answer as the solution.

Good Work
