forked from GoogleChromeLabs/application-shell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
25 lines (22 loc) · 1023 Bytes
/
app.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
'use strict';
/**
*
* The structure of this node server is the following:
* 1.) server-controller starts an express server which defines the static
* content, port number and sets up handle bars to use the views and layouts
* 2.) URLs are then routed by defining a url and calling addEndpoint(). On
* requests to a matching url the onRequest() method is called in the
* passed in controller (i.e. StaticPageController)
*
*/
var serverController = require('./server/controllers/server-controller');
var StaticPageController = require(
'./server/controllers/static-page-controller');
var APIController = require('./server/controllers/api-controller');
// APIController serves up the HTML without any HTML body or head
serverController.addEndpoint('/api*', new APIController(
serverController.getHandleBarsInstance()
));
// The static page controller serves the basic form of the pages
serverController.addEndpoint('/*', new StaticPageController());
serverController.startServer(process.env.PORT);