added more instructions, service template

This commit is contained in:
Tony Tam 2015-03-19 14:47:43 -07:00
parent 531e2d7032
commit ae1d43dc84
2 changed files with 21 additions and 1 deletions

View File

@ -43,7 +43,9 @@ public class NodeJSServerCodegen extends DefaultCodegen implements CodegenConfig
* @return A string value for the help message
*/
public String getHelp() {
return "Generates a nodejs server library.";
return "Generates a nodejs server library using the swagger-tools project. By default, " +
"it will not generate service classes--which you will have to implement on your own or let " +
"the codegen do it with the `-Dservice` environment variable.";
}
public NodeJSServerCodegen() {

View File

@ -0,0 +1,18 @@
'use strict';
{{#operations}}
{{#operation}}
exports.{{nickname}} = function({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
var examples = {};
{{#examples}}
examples['{{contentType}}'] = {{{example}}};
{{/examples}}
{{#returnType}}
if(Object.keys(examples).length > 0)
return examples[Object.keys(examples)[0]];
{{/returnType}}
}
{{/operation}}
{{/operations}}