working ish website
This commit is contained in:
parent
5540ac6d81
commit
b194d2031d
8 changed files with 271 additions and 6 deletions
11
index.js
11
index.js
|
|
@ -20,6 +20,14 @@ app.use(passport.session());
|
|||
app.use(express.json());
|
||||
app.use(express.urlencoded({ extended: true }));
|
||||
|
||||
app.get('/selfservice/api/whoami', function (req, res) {
|
||||
if (!req.isAuthenticated()) {
|
||||
return res.status(401).send('Unauthorized');
|
||||
}
|
||||
// Send user type and upn in json format
|
||||
res.send({ userType: req.user.userType, upn: req.user.username });
|
||||
});
|
||||
|
||||
let authRoutes = require('./routes/auth.js');
|
||||
app.use('/', authRoutes);
|
||||
let psRelationStudentRoutes = require('./routes/ps_relation_student.js');
|
||||
|
|
@ -27,6 +35,9 @@ app.use('/selfservice/api', psRelationStudentRoutes);
|
|||
let psRelationParentRoutes = require('./routes/ps_relation_parent.js');
|
||||
app.use('/selfservice/api', psRelationParentRoutes);
|
||||
|
||||
// Serve Static Files
|
||||
app.use("/",express.static('statics'));
|
||||
|
||||
let server = https.createServer(http_config.options, app);
|
||||
server.listen(3000, function () {
|
||||
console.log('Listening on port 3000');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue