gpt4 book ai didi

javascript - 铁路中的 express-subdomain-handler 告诉我子域参数(在 route )是 Controller 为什么?

转载 作者:行者123 更新时间:2023-11-30 18:29:38 31 4
gpt4 key购买 nike

好的,我遇到了这个问题。我有这条路线:(代码位更改) 文件:/home/dotcloud/current/config/routes.js

exports.routes = function (map) {

// Generic routes. Add all your routes below this line
// feel free to remove generic routes
//map.all(':controller/:action');
// map.all(':controller/:action/:id');


var sitesControllers = [
"RequestSiteLogin",
"IsValidSiteLogin",
"HoldSiteLogin",
"RequestSiteProfile",
"LogoutSite",
"RevalidState"
];
map.namespace('/subdomain/Users/:id/SitesCotnrol/', function (site) {
site.resources('sites',{only: sitesControllers},function (action) {
action.post("RequestSiteLogin","SitesCotnrol/RequestSiteLogin#:id");
action.post("IsValidSiteLogin","SitesCotnrol/IsValidSiteLogin#:id");
action.post("HoldSiteLogin","SitesCotnrol/HoldSiteLogin#:id");
action.post("RequestSiteProfile","SitesCotnrol/RequestSiteProfile#:id");
action.post("LogoutSite","SitesCotnrol/LogoutSite#:id");
action.post("RevalidState","SitesCotnrol/RevalidSite#:id");
});
});

var adminControllers = [
"AddSite",
"RemoveSite",
"HoldAllSites",
"LogoutApplication",
"UpdateApplicationSettings",
"Echo"
];
map.namespace('/subdomain/Applciation/Control',function (admin) {
admin.resources('admin',{only: adminControllers},function (action) {
action.post("AddSite","/subdomain/Application/Control/AddSite");
action.post("RemoveSite","/subdomain/Application/Control/RemoveSite#:id");
action.get("Echo","#echo");
action.get("HoldAllSites","/subdomain/Application/Control/HoleAll");
action.get("LogoutApplication","/subdomain/Application/Control/LogoutApplication");
action.get("UpdateApplicationSettings","/subdomain/Application/Control/UpdateApplicationSettings");
});
});
};

现在我尝试开始的 url 是这样的: http://application.pmpdevelopmentfront.tk/control#echo页面中的错误参数 ControlDomain 与子域相同,请参阅 https://github.com/WilsonPage/express-subdomain-handler请不确定在这里做什么。

周四更新路线:

dotcloud@frontend-default-www-0:~/current$ ./node_modules/railway/bin/railway  routes
info - socket.io started
_subdomain_User_SitesCotnrol_site_RequestSiteLogin POST //subdomain/Users/:id/SitesCotnrol/sites/:site_id/RequestSiteLogin /subdomain/Users/:id/SitesCotnrol/SitesCotnrol/RequestSiteLogin#:id
_subdomain_User_SitesCotnrol_site_IsValidSiteLogin POST //subdomain/Users/:id/SitesCotnrol/sites/:site_id/IsValidSiteLogin /subdomain/Users/:id/SitesCotnrol/SitesCotnrol/IsValidSiteLogin#:id
_subdomain_User_SitesCotnrol_site_HoldSiteLogin POST //subdomain/Users/:id/SitesCotnrol/sites/:site_id/HoldSiteLogin /subdomain/Users/:id/SitesCotnrol/SitesCotnrol/HoldSiteLogin#:id
_subdomain_User_SitesCotnrol_site_RequestSiteProfile POST //subdomain/Users/:id/SitesCotnrol/sites/:site_id/RequestSiteProfile /subdomain/Users/:id/SitesCotnrol/SitesCotnrol/RequestSiteProfile#:id
_subdomain_User_SitesCotnrol_site_LogoutSite POST //subdomain/Users/:id/SitesCotnrol/sites/:site_id/LogoutSite /subdomain/Users/:id/SitesCotnrol/SitesCotnrol/LogoutSite#:id
_subdomain_User_SitesCotnrol_site_RevalidState POST //subdomain/Users/:id/SitesCotnrol/sites/:site_id/RevalidState /subdomain/Users/:id/SitesCotnrol/SitesCotnrol/RevalidSite#:id
_subdomain_Applciation_Control__AddSite POST //subdomain/Applciation/Control/admin/:admin_id/AddSite /subdomain/Applciation/Control//subdomain/Application/Control/AddSite#undefined
_subdomain_Applciation_Control__RemoveSite POST //subdomain/Applciation/Control/admin/:admin_id/RemoveSite /subdomain/Applciation/Control//subdomain/Application/Control/RemoveSite#:id
_subdomain_Applciation_Control__Echo GET //subdomain/Applciation/Control/admin/:admin_id/Echo /subdomain/Applciation/Control/#echo
_subdomain_Applciation_Control__HoldAllSites GET //subdomain/Applciation/Control/admin/:admin_id/HoldAllSites /subdomain/Applciation/Control//subdomain/Application/Control/HoleAll#undefined
_subdomain_Applciation_Control__LogoutApplication GET //subdomain/Applciation/Control/admin/:admin_id/LogoutApplication /subdomain/Applciation/Control//subdomain/Application/Control/LogoutApplication#undefined
_subdomain_Applciation_Control__UpdateApplicationSettings GET //subdomain/Applciation/Control/admin/:admin_id/UpdateApplicationSettings /subdomain/Applciation/Control//subdomain/Application/Control/UpdateApplicationSettings#undefined

最佳答案

首先,删除通用路由:

// Generic routes. Add all your routes below this line
// feel free to remove generic routes
map.all(':controller/:action');
map.all(':controller/:action/:id');

您可能会错过的第二件事:命名空间。尝试使用 CLI 调试您的路线:railway routes

第三:需要检查您的 esh 初始化(正确的前缀,正确连接管理命名空间前缀)。

顺便说一句:子域看起来像是当前铁路路线实现中缺少的功能。为什么不直接向该模块添加子域处理并避免额外的代码和依赖项。

关于javascript - 铁路中的 express-subdomain-handler 告诉我子域参数(在 route )是 Controller 为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10023844/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com