const express = require('express');
const ParseServer = require('parse-server').ParseServer;

const app = express();

const api = new ParseServer({
  databaseURI: 'mongodb://localhost:27017/your_db',
  appId: 'YOUR_APP_ID',
  masterKey: 'YOUR_MASTER_KEY',
  serverURL: 'http://localhost:1337/parse',
  cloud: './cloud/main.js' // 指定云代码入口
});

// 挂载 Parse API
app.use('/parse', api);

// 加载云代码
require('./cloud/main');

app.listen(1337, () => {
  console.log('Parse Server running on port 1337');
});