forked from loafle/openapi-generator-original
updated templates
This commit is contained in:
parent
a6744507ef
commit
0c3e82e375
@ -1,10 +1,8 @@
|
||||
# Swagger generated server
|
||||
|
||||
## Overview
|
||||
This server was generated by the [swagger-codegen](https://github.com/wordnik/swagger-codegen) project. By using the
|
||||
[swagger-spec](https://github.com/wordnik/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
|
||||
is an example of building a node.js server.
|
||||
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate a server stub. This is an example of building a node.js server.
|
||||
|
||||
This example uses the [expressjs](http://expressjs.com/) framework. To see how to make this your own, look here:
|
||||
|
||||
[README](https://github.com/wordnik/swagger-codegen/tree/master/samples/server-generator/node)
|
||||
[README](https://github.com/wordnik/swagger-codegen/README.md)
|
@ -1,11 +1,10 @@
|
||||
var express = require("express")
|
||||
, url = require("url")
|
||||
, cors = require("cors")
|
||||
, app = express()
|
||||
, swagger = require("swagger-node-express")
|
||||
, db = false
|
||||
|
||||
var app = express();
|
||||
app.use(express.bodyParser());
|
||||
|
||||
var corsOptions = {
|
||||
credentials: true,
|
||||
@ -18,6 +17,8 @@ var corsOptions = {
|
||||
}
|
||||
};
|
||||
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded());
|
||||
app.use(cors(corsOptions));
|
||||
|
||||
{{#basePath}}
|
||||
@ -42,8 +43,8 @@ var {{classname}} = require("./{{apiFolder}}/{{classname}}.js");
|
||||
{{/apiInfo}}
|
||||
|
||||
swagger.addModels(models)
|
||||
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}.add{{httpMethod}}({{classname}}.{{nickname}}){{/operation}}{{/operations}}
|
||||
{{/apis}}{{/apiInfo}};
|
||||
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}.add{{httpMethod}}({{classname}}.{{nickname}})
|
||||
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}};
|
||||
|
||||
// configures the app
|
||||
swagger.configure("http://localhost:8002{{basePath}}", "0.1");
|
||||
|
@ -3,7 +3,7 @@
|
||||
"description": "Wordnik node.js server generator",
|
||||
"version": "{{{artifactVersion}}}",
|
||||
"homepage": "{{{homepage}}}",
|
||||
"main": "./{{codeDir}}/main.js",
|
||||
"main": "./main.js",
|
||||
"engines": {
|
||||
"node": ">= 0.8.x"
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user