| 12345678910111213141516171819202122232425262728 |
- 'use strict';
- module.exports = {
- init: init
- };
- var express = require('express'),
- bodyParser = require('body-parser'),
- routes = require('./routes.js');
- function init(hueConfig) {
- var app = express();
- app.use(express.static('frontend'));
- app.use(bodyParser.json());
- app.get ('/api/config', routes.getConfig);
- app.get ('/api/lights', routes.getLights);
- app.post('/api/lights/:id', routes.setLight);
- routes.init(hueConfig, function (error) {
- if (error) return console.error(error);
- app.listen(3000, function () {
- console.log('Server listening on port 3000');
- });
- });
- }
|