-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
36 lines (28 loc) · 969 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"use strict";
var Http = require("http");
var Express = require("express");
var BodyParser = require("body-parser");
var Swaggerize = require("swaggerize-express");
var Path = require("path");
var App = Express();
var Server = Http.createServer(App);
App.use(BodyParser.json());
App.use(BodyParser.urlencoded({
extended: true
}));
App.use(Express.static("public"));
App.use(function (req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
App.use(Swaggerize({
api: Path.resolve("./config/swagger.yaml"),
handlers: Path.resolve("./handlers")
}));
Server.listen(8000, function () {
App.swagger.api.host = this.address().address + ":" + this.address().port;
/* eslint-disable no-console */
console.log("App running on %s:%d", this.address().address, this.address().port);
/* eslint-disable no-console */
});