Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

微信分享域名配置问题 #194

Open
wufangjian opened this issue Mar 25, 2018 · 0 comments
Open

微信分享域名配置问题 #194

wufangjian opened this issue Mar 25, 2018 · 0 comments

Comments

@wufangjian
Copy link

wufangjian commented Mar 25, 2018

image

请教一下, 在做微信分享的过程遇到的路由问题。 怎样才能通过 http://www.xxxx.com/MP_verify_aaaaaaaaaa.txt 该链接访问到 MP_verify_aaaaaaaaaa.txt资源?


通过配置中间件插件(静态化)可以吗?这样做是否合理

module.exports.static = function(app, conf){
    return function(){
        app.use(conf.urlPattern, yog.express.static(conf.staticPath, conf.options));
        app.use('/MP_verify_aaaaaaaaaa.txt', yog.express.static(yog.ROOT_PATH + '/MP_verify_aaaaaaaaaa.txt', conf.options));
        //拦截404
        app.use(conf.urlPattern, conf.notFound);        
    };
};

module.exports.static.defaultConf = {
    options: {
        maxAge: 0
    },
    staticPath: yog.ROOT_PATH + '/static',
    urlPattern: '/static',
    notFound: function(req, res){
        res.status(404);
        res.send('404: Resource not Found');
    }
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant