Parse.com - 静态文件与动态 URL 顺序 [英] Parse.com - Static files vs Dynamic URLs order

查看:51
本文介绍了Parse.com - 静态文件与动态 URL 顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试先执行云代码,然后再在 Parse.com 云代码的/public 目录中查找文件.

I'm trying to execute cloud code first, before looking for files in the /public directory on Parse.com Cloud code.

阅读 ExpressJS 文档,我发现您可以使用

Reading ExpressJS documentation, I've found that you can change the precedence using

app.use(app.router);
app.use(express.static(__dirname + '/public'));

问题是当我尝试部署解析时,出现以下错误

the problem is when I try to deploy to parse, I get the following error

更新失败,无法加载触发器.错误是ReferenceError: __dirname 未定义

Update failed with Could not load triggers. The error was ReferenceError: __dirname is not defined

是否支持 __dirname ?

推荐答案

它只是 express.static('public'); 但是,这可能行不通.Parse Hosting 可能会完全跳过触摸/查看公共文件夹下 URL 的云代码(事实上,我 99% 确定确实如此.)

It would just be express.static('public'); however, this probably won't work. Parse Hosting may completely skip touching/looking at cloud code for URLs under the public folder (in fact, I'm 99% sure it does.)

这篇关于Parse.com - 静态文件与动态 URL 顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆