@@ -17,42 +17,40 @@ var utils = require('./utils')
1717var history = require ( './history' )
1818
1919// public
20- var response = {
21- errorForbidden : function ( res ) {
22- const { req } = res
23- if ( req . user ) {
24- responseError ( res , '403' , 'Forbidden' , 'oh no.' )
25- } else {
26- req . flash ( 'error' , 'You are not allowed to access this page. Maybe try logging in?' )
27- res . redirect ( config . serverURL + '/' )
28- }
29- } ,
30- errorNotFound : function ( res ) {
31- responseError ( res , '404' , 'Not Found' , 'oops.' )
32- } ,
33- errorBadRequest : function ( res ) {
34- responseError ( res , '400' , 'Bad Request' , 'something not right.' )
35- } ,
36- errorTooLong : function ( res ) {
37- responseError ( res , '413' , 'Payload Too Large' , 'Shorten your note!' )
38- } ,
39- errorInternalError : function ( res ) {
40- responseError ( res , '500' , 'Internal Error' , 'wtf.' )
41- } ,
42- errorServiceUnavailable : function ( res ) {
43- res . status ( 503 ) . send ( "I'm busy right now, try again later." )
44- } ,
45- newNote : newNote ,
46- showNote : showNote ,
47- showPublishNote : showPublishNote ,
48- showPublishSlide : showPublishSlide ,
49- showIndex : showIndex ,
50- noteActions : noteActions ,
51- publishNoteActions : publishNoteActions ,
52- publishSlideActions : publishSlideActions ,
53- githubActions : githubActions ,
54- gitlabActions : gitlabActions
20+ exports . errorForbidden = function ( res ) {
21+ const { req } = res
22+ if ( req . user ) {
23+ responseError ( res , '403' , 'Forbidden' , 'oh no.' )
24+ } else {
25+ req . flash ( 'error' , 'You are not allowed to access this page. Maybe try logging in?' )
26+ res . redirect ( config . serverURL + '/' )
27+ }
28+ }
29+ exports . errorNotFound = function ( res ) {
30+ responseError ( res , '404' , 'Not Found' , 'oops.' )
5531}
32+ exports . errorBadRequest = function ( res ) {
33+ responseError ( res , '400' , 'Bad Request' , 'something not right.' )
34+ }
35+ exports . errorTooLong = function ( res ) {
36+ responseError ( res , '413' , 'Payload Too Large' , 'Shorten your note!' )
37+ }
38+ exports . errorInternalError = function ( res ) {
39+ responseError ( res , '500' , 'Internal Error' , 'wtf.' )
40+ }
41+ exports . errorServiceUnavailable = function ( res ) {
42+ res . status ( 503 ) . send ( "I'm busy right now, try again later." )
43+ }
44+ exports . newNote = newNote
45+ exports . showNote = showNote
46+ exports . showPublishNote = showPublishNote
47+ exports . showPublishSlide = showPublishSlide
48+ exports . showIndex = showIndex
49+ exports . noteActions = noteActions
50+ exports . publishNoteActions = publishNoteActions
51+ exports . publishSlideActions = publishSlideActions
52+ exports . githubActions = githubActions
53+ exports . gitlabActions = gitlabActions
5654
5755function responseError ( res , code , detail , msg ) {
5856 res . status ( code ) . render ( 'error.ejs' , {
@@ -635,5 +633,3 @@ function renderPublishSlide (data, res) {
635633 } )
636634 res . render ( 'slide.ejs' , data )
637635}
638-
639- module . exports = response
0 commit comments