README
C++ WSF CLI Tool
Use this CLI tool to bootstrap, lint and create templates for your WSF projects.
Installation
(sudo) npm install wsf-cli -g
# or with yarn
yarn global add wsf-cli
Help options
Usage:
wsf [OPTIONS] [ARGS]
Options:
-n, --new STRING Create a new project
-r, --route STRING Create a new template route
-s, --service STRING Create a new template service
-h, --help Display help and usage details
Creating a new project
Generate a new YungC++ project in a new folder called /Hello
:
wsf new project Hello
Generate a new route
Run the command:
wsf 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:
wsf 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