Skip to content

Commit

Permalink
Add beginnings of new example app
Browse files Browse the repository at this point in the history
  • Loading branch information
Louis Cheung committed Jun 4, 2015
1 parent f05a51f commit e65e356
Show file tree
Hide file tree
Showing 25 changed files with 48 additions and 6,503 deletions.
43 changes: 0 additions & 43 deletions example/api.coffee

This file was deleted.

36 changes: 0 additions & 36 deletions example/api.yml

This file was deleted.

59 changes: 16 additions & 43 deletions example/app.js
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);
});
8 changes: 0 additions & 8 deletions example/public/stylesheets/style.css

This file was deleted.

135 changes: 0 additions & 135 deletions example/public/swagger/css/hightlight.default.css

This file was deleted.

Loading

0 comments on commit e65e356

Please sign in to comment.