mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-05-13 08:31:19 +00:00
28 lines
589 B
Plaintext
28 lines
589 B
Plaintext
var express = require("express")
|
|
, url = require("url")
|
|
, swagger = require("swagger-node-express")
|
|
, db = false
|
|
|
|
var app = express();
|
|
app.use(express.bodyParser());
|
|
|
|
swagger.setAppHandler(app);
|
|
|
|
// resources for the demo
|
|
{{#apis}}
|
|
var {{name}}Api = require("./apis/{{className}}.js");
|
|
{{/apis}}
|
|
|
|
swagger.addModels(models)
|
|
{{#apis}}
|
|
{{#operations}}
|
|
{{#operation}}.add{{httpMethod}}({{name}}Api.{{nickname}}){{/operation}}{{newline}}
|
|
{{/operations}}
|
|
{{/apis}};
|
|
|
|
// configures the app
|
|
swagger.configure("http://localhost:8002", "0.1");
|
|
|
|
// start the server
|
|
app.listen(8002);
|