Files
  • index.js
  • bin
  • public
  • routes
  • views
  • app.js
  • package-lock.json
  • package.json
index.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// All scores out of 5
// File system: 4
//   - Your file system was great, I loved the display it gave of your current directory. The problem was it was extremely slow. I usually wouldn't deduct points for some a thing, however you could only move one dir at a time, and took forever.
// Coding: 5
//   - Your file writting and running worked perfect. The editor worked very well, and was really pretty.
// Login: 3
//   - Your login worked file, however didn't have much else, maybe add a way too make files readable to other users?
// Interface: 3
//   - So close to getting a 5, your interface was beuatiful. The problem was, it was buggy. More often than not lines of text would cut off, and you'd have to run the command again to try and read it.
// EOO: 3
//   - Your OS was very easy to use! Especially the writer, which worked very well. Sadly this also was hit by the extremely buggy display which made the OS much harder to use than it should have been.
// Docs: 2
//   - The docs were clean and well organized. The problem came when the OS would cut off the documentation text, making it impossible to read fully.
// Extras: 1
//   - The ability to change from light theme to dark was great, although I stuck to dark.
// TOTAL: 21 / 35
var createError = require('http-errors');
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
var hbs = require('express-handlebars');
var cookies = require('cookies');

var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');
var superRouter = require('./routes/super');

var app = express();

// view engine setup
app.engine('hbs',hbs({extname: 'hbs', layoutsDir: __dirname + '/views/', defaultLayout: 'layout'}))
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'hbs');

app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(cookies.express(['abc','def','ghi']))
app.use(express.static(path.join(__dirname, 'public')));

app.use('/', indexRouter);
app.use('/user', usersRouter);
app.use('/superuser', superRouter);


// catch 404 and forward to error handler
app.use(function(req, res, next) {
  next(createError(404));
});

// error handler
app.use(function(err, req, res, next) {
  // set locals, only providing error in development
  res.locals.message = err.message;
  res.locals.error = req.app.get('env') === 'development' ? err : {};

  // render the error page
  res.status(err.status || 500);
  res.render('error');
});
var server = app.listen(3000)

module.exports = app;
node v10.15.2 linux/amd64