diff --git a/app.js b/app.js index a69fa946..7e41fded 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,5 @@ #!/usr/bin/env node -import createError from 'http-errors' import express from 'express' import path from 'path' import cookieParser from 'cookie-parser' @@ -20,10 +19,6 @@ const __dirname = path.dirname(__filename) const app = express() -// view engine setup -app.set('views', path.join(__dirname, 'views')) -app.set('view engine', 'ejs') - //Middleware to use /** @@ -76,7 +71,7 @@ app.use(express.static(path.join(__dirname, 'public'))) */ app.all('*', (req, res, next) => { if(process.env.DOWN === "true"){ - res.status(503).json({"message":"RERUM v1 is down for updates or maintenance at this time. We aplologize for the inconvenience. Try again later."}) + res.status(503).json({"message":"RERUM v1 is down for updates or maintenance at this time. We apologize for the inconvenience. Try again later."}) } else{ next() //pass on to the next app.use diff --git a/bin/rerum_v1.js b/bin/rerum_v1.js index c74ee862..4efac21f 100644 --- a/bin/rerum_v1.js +++ b/bin/rerum_v1.js @@ -56,11 +56,9 @@ function onError(error) { case 'EACCES': console.error(bind + ' requires elevated privileges') process.exit(1) - break case 'EADDRINUSE': console.error(bind + ' is already in use') process.exit(1) - break default: throw error } diff --git a/rest.js b/rest.js index 55093541..187535bd 100644 --- a/rest.js +++ b/rest.js @@ -17,7 +17,7 @@ * X-HTTP-Method-Override header is present, !== PATCH means "no", you have done a POST and are not emulating it as a PATCH, so 405 * X-HTTP-Method-Override header is present, == PATCH, and method request is POST means "yes", you are emulating a POST as a PATCH, correct method 200 * - * The error handler sits a level up, so do not res.send() or res.render here. Just give back a boolean + * The error handler sits a level up, so do not res.send() here. Just give back a boolean */ const checkPatchOverrideSupport = function (req, res) { const override = req.header("X-HTTP-Method-Override") diff --git a/routes/index.js b/routes/index.js index e08332ad..f4b4a938 100644 --- a/routes/index.js +++ b/routes/index.js @@ -3,7 +3,7 @@ const router = express.Router() /* GET home page. */ router.get('/', (req, res, next) => { - res.render('index', { title: 'RERUM' }) + res.sendFile('index.html', { root: 'public' }) }) export default router diff --git a/views/error.ejs b/views/error.ejs deleted file mode 100644 index 7cf94edf..00000000 --- a/views/error.ejs +++ /dev/null @@ -1,3 +0,0 @@ -

<%= message %>

-

<%= error.status %>

-
<%= error.stack %>
diff --git a/views/index.ejs b/views/index.ejs deleted file mode 100644 index ff08b5e7..00000000 --- a/views/index.ejs +++ /dev/null @@ -1,15 +0,0 @@ - - - - <%= title %> - - - -

<%= title %>

-

Welcome to <%= title %>, the public repository service from Saint Louis University's Research Computing Group.

- - -