-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Louis Cheung
committed
Jun 4, 2015
1 parent
f05a51f
commit e65e356
Showing
25 changed files
with
48 additions
and
6,503 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,26 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
var express = require('express') | ||
, api = require('./api') | ||
, http = require('http') | ||
, path = require('path') | ||
, swagger = require('../'); | ||
var express = require('express'), | ||
routes = require('./routes'), | ||
swagger = require('jsdoc-express-with-swagger'); | ||
|
||
var app = express(); | ||
|
||
app.configure(function(){ | ||
app.set('port', process.env.PORT || 3000); | ||
app.set('views', __dirname + '/views'); | ||
app.set('view engine', 'jade'); | ||
app.use(express.favicon()); | ||
app.use(express.logger('dev')); | ||
app.use(express.bodyParser()); | ||
app.use(express.methodOverride()); | ||
app.all('/*', function(req, res, next) { | ||
res.header('Access-Control-Allow-Origin', '*'); | ||
next(); | ||
}); | ||
|
||
app.use(swagger.init(app, { | ||
apiVersion: '1.0', | ||
swaggerVersion: '1.0', | ||
basePath: 'http://localhost:3000', | ||
swaggerURL: '/swagger', | ||
swaggerJSON: '/api-docs.json', | ||
swaggerUI: './public/swagger/', | ||
apis: ['./api.js', './api.yml', 'api.coffee'] | ||
})); | ||
app.use(app.router); | ||
app.use(express.static(path.join(__dirname, 'public'))); | ||
swagger.init(app, { | ||
swaggerJsonPath: '/api.json', | ||
swaggerUiPath: '/api', | ||
info: { | ||
title: 'Hello World', | ||
version: '1.0.0', | ||
apis: ['./routes.js'], | ||
} | ||
}); | ||
|
||
app.configure('development', function(){ | ||
app.use(express.errorHandler()); | ||
}); | ||
|
||
app.get('/', function(req, res){ | ||
res.render('index', { title: 'Express' }); | ||
}); | ||
routes.setup(app); | ||
|
||
app.post('/login', api.login); | ||
var server = app.listen(3000, function () { | ||
var host = server.address().address; | ||
var port = server.address().port; | ||
|
||
http.createServer(app).listen(app.get('port'), function(){ | ||
console.log("Express server listening on port " + app.get('port')); | ||
console.log('Example app listening at http://%s:%s', host, port); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.