Yung C++ CLI Tool
Use this CLI tool to easily bootstrap new Yung C++ projects and create project templates.
Installation
(sudo) npm install yungcli -g
# or with yarn
yarn global add yungcli
Creating a new project
Generate a new YungC++ project in a new folder called /Hello
:
yungcli new project Hello
Generate a new route
Run the command:
yungcli new route Hello
This will create ./routes/Hello.route.hpp
:
#include "../Shared.hpp"
#ifndef _HELLOROUTE_H
#define _HELLOROUTE_H 1
namespace yungroute {
std::pair<web::http::status_code, std::string> hello() {
web::json::value info;
unsigned short status = 200;
info = yungservice::metadata(info);
std::string payload = info.serialize().c_str();
return make_pair(status, payload);
}
}
#endif
Generate a new service
Run the command:
yungcli new service Hello
This will create ./services/Hello.service.hpp
:
#include "../Shared.hpp"
#ifndef _HELLOSERVICE_H
#define _HELLOSERVICE_H 1
namespace yungservice {
web::json::value hello(web::json::value info) {
return info;
}
}
#endif