dev-server.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. const express = require('express');
  2. const path = require('path');
  3. const ParseServer = require('parse-server').ParseServer;
  4. const app = express();
  5. const api = new ParseServer({
  6. databaseURI: 'postgresql://dev:666@dev.fmode.cn:5432/dev',
  7. appId: 'dev',
  8. masterKey: 'devmk',
  9. masterKeyIps: ['0.0.0.0/0','::/0'] ,
  10. allowClientClassCreation:true,
  11. allowHeaders:["*"],
  12. allowOrigin:"*",
  13. // fileKey: 'myFileKey',
  14. // cloud: './cloud/main.js',
  15. // push: { ... }, // See the Push wiki page
  16. // filesAdapter: ...,
  17. }
  18. );
  19. async function main(){
  20. await api.start();
  21. app.use(express.json());
  22. // Serve the Parse API at /parse URL prefix
  23. app.use('/parse', api.app);
  24. // 加载Agent专用路由
  25. const pdfRouter = require('./api/agent/loader/routes'); // 根据你的文件结构调整路径
  26. app.use('/api/agent', pdfRouter); // 使用路由
  27. const retriveRouter = require('./api/agent/retrive/routes'); // 根据你的文件结构调整路径
  28. app.use('/api/agent', retriveRouter); // 使用路由
  29. const port = 1337;
  30. app.listen(port, function() {
  31. console.log('parse-server-example running on port ' + port + '.');
  32. });
  33. }
  34. main();