如何在c ++ crow中获取非int资源ID。我无法添加路线
CROW_ROUTE(app, "/uid/<char*>")
或int main() {
crow::SimpleApp app;
CROW_ROUTE(app, "/uid/*").methods("GET"_method)
([](const crow::request& req){
return "hello";
});
CROW_ROUTE(app, "/uid/<int>").methods("GET"_method)
([](const crow::request& req, int id){
return std::to_string(id);
});
app.port(8888).run();
}
,因为它无法编译。 examples donot有这样的情况。我试过了
GET /uid/uid_123 HTTP/1.1
但他们都没有(虽然正确)拦截"uid_123"
(资源是字符串from flask import Flask
app = Flask(__name__)
@app.route("/uid/<path:path>")
def hello1(path):
print ("it is path is ", path)
return "user id is -" + path
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8888)
)
对于下面的python代码,我想在c ++ crow库中实现它
var app = express();
app.use("/cars", carRouter);
以上是否有解决方法?