diff --git a/.eslintrc.json b/.eslintrc.json
index 5df3444a6..23bdea410 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -55,6 +55,7 @@
"no-var": [2],
"no-lonely-if": [2],
"curly": [2],
+ "no-unused-vars": ["error", { "argsIgnorePattern": "next" }],
"no-multiple-empty-lines": [
"error",
{"max": 1}
diff --git a/app.js b/app.js
index d4041c93a..29817c970 100644
--- a/app.js
+++ b/app.js
@@ -11,14 +11,57 @@ app.use(bodyParser.json());
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
-// API Routes.
+// Routes.
app.use('/api/v1', require('./routes/api'));
+app.use('/client', express.static(path.join(__dirname, 'dist')));
+app.use('/admin', require('./routes/admin'));
-// Static Routes.
-app.use('/client/', express.static(path.join(__dirname, 'dist')));
+//==============================================================================
+// ERROR HANDLING
+//==============================================================================
-app.get('/admin*', (req, res) => {
- res.render('admin', {basePath: '/client/coral-admin'});
+const ErrNotFound = new Error('Not Found');
+ErrNotFound.status = 404;
+
+// Catch 404 and forward to error handler.
+app.use((req, res, next) => {
+ next(ErrNotFound);
+});
+
+// General error handler. Respond with the message and error if we have it while
+// returning a status code that makes sense.
+if (app.get('env') === 'development') {
+ app.use('/api', (err, req, res, next) => {
+ res.status(err.status || 500);
+ res.json({
+ message: err.message,
+ error: err
+ });
+ });
+
+ app.use('/', (err, req, res, next) => {
+ res.status(err.status || 500);
+ res.render('error', {
+ message: err.message,
+ error: err
+ });
+ });
+}
+
+app.use('/api', (err, req, res, next) => {
+ res.status(err.status || 500);
+ res.json({
+ message: err.message,
+ error: {}
+ });
+});
+
+app.use('/', (err, req, res, next) => {
+ res.status(err.status || 500);
+ res.render('error', {
+ message: err.message,
+ error: {}
+ });
});
module.exports = app;
diff --git a/client/coral-admin/src/AppRouter.js b/client/coral-admin/src/AppRouter.js
new file mode 100644
index 000000000..40465bd19
--- /dev/null
+++ b/client/coral-admin/src/AppRouter.js
@@ -0,0 +1,23 @@
+import React from 'react'
+import { Router, Route, Redirect, IndexRoute, browserHistory } from 'react-router'
+
+import ModerationQueue from 'containers/ModerationQueue'
+import CommentStream from 'containers/CommentStream'
+import EmbedLink from 'components/EmbedLink'
+import Configure from 'containers/Configure'
+import CommunityContainer from 'containers/CommunityContainer'
+import LayoutContainer from 'containers/LayoutContainer'
+
+const routes = (
+
<%= message %>+ +
<%= error.stack %>+ +