summaryrefslogtreecommitdiffstats
path: root/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'app.js')
-rwxr-xr-xapp.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/app.js b/app.js
new file mode 100755
index 0000000..21a798c
--- /dev/null
+++ b/app.js
@@ -0,0 +1,25 @@
+const path = require("path");
+const express = require("express");
+require('./server/db/mongoose');
+const userRoutes = require('./server/routes/user');
+const auth = require('./server/middleware/auth');
+
+const app = express();
+const port = process.env.PORT || 3000;
+
+app.use(express.json());
+
+app.use('/api/user/', userRoutes);
+
+app.use('/admin/', auth, express.static(path.join(__dirname, 'client/admin')));
+
+app.use('/login/', express.static(path.join(__dirname, 'client/login')));
+
+app.use('/', express.static(path.join(__dirname, 'client/public')));
+
+app.get('*', (req, res) => res.redirect('/'));
+
+app.listen(port, () => {
+ console.log("Server is up on port " + port + ".");
+});
+