End-point to get GitLab data.
This commit is contained in:
parent
e545de72a6
commit
ad79b581bd
1 changed files with 16 additions and 0 deletions
16
app.js
16
app.js
|
@ -16,6 +16,7 @@ var formidable = require('formidable');
|
|||
var morgan = require('morgan');
|
||||
var passportSocketIo = require("passport.socketio");
|
||||
var helmet = require('helmet');
|
||||
var request = require('request');
|
||||
|
||||
//core
|
||||
var config = require("./lib/config.js");
|
||||
|
@ -82,6 +83,9 @@ var sessionStore = new SequelizeStore({
|
|||
//compression
|
||||
app.use(compression());
|
||||
|
||||
//cookies
|
||||
app.use(cookieParser());
|
||||
|
||||
// use hsts to tell https users stick to this
|
||||
app.use(helmet.hsts({
|
||||
maxAge: 31536000 * 1000, // 365 days
|
||||
|
@ -438,6 +442,18 @@ app.post('/uploadimage', function (req, res) {
|
|||
}
|
||||
});
|
||||
});
|
||||
//get gitlab parameters
|
||||
app.get('/gitlab', function (req, res) {
|
||||
var ret = { baseURL: config.gitlab.baseURL };
|
||||
models.User.findById(req.cookies.userid)
|
||||
.then(function(user) {
|
||||
ret.accesstoken = user.accessToken;
|
||||
return res.send(ret);
|
||||
}).catch(function(err) {
|
||||
logger.error('user search failed: ' + err);
|
||||
return done(err, null);
|
||||
});
|
||||
});
|
||||
//get new note
|
||||
app.get("/new", response.newNote);
|
||||
//get publish note
|
||||
|
|
Loading…
Reference in a new issue