diff options
author | 2020-11-16 00:10:28 +0100 | |
---|---|---|
committer | 2020-11-16 00:10:28 +0100 | |
commit | e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d (patch) | |
tree | 55713f725f77b44ebfec86e4eec3ce33e71458ca /app.js | |
download | website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.tar.gz website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.tar.bz2 website_creator-e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d.zip |
api, login, auth
Diffstat (limited to 'app.js')
-rwxr-xr-x | app.js | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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 + "."); +}); + |