Skip to content

Commit

Permalink
Show REST API version, description, and status
Browse files Browse the repository at this point in the history
  • Loading branch information
evanxd committed Apr 21, 2016
1 parent ab8b931 commit 0517790
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,22 @@ var projects = require('./lib/projects');
var config = require('./config.js');
var app = express();

app.use(express.static('./sensorweb-frontend'));
// app.use(express.static('./sensorweb-frontend'));
app.use(bodyParser.urlencoded({ extended: false }));

mongoose.connect('mongodb://localhost/test');
var db = mongoose.connection;

db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function() {
app.route('/').get(function(req, res, next) {
res.jsonp({
version: config.version,
description: config.description,
status: 'good'
});
});

// Get all sensors API is only for testing.
app.route('/sensors')
.get(sensors.getSensors)
Expand Down
2 changes: 2 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'use strict';

module.exports = {
version: '0.0.1',
description: 'SensorWeb REST APIs',
express: {
port: 3000
},
Expand Down

0 comments on commit 0517790

Please sign in to comment.