mirror of
https://github.com/status-im/codimd.git
synced 2025-01-11 23:14:24 +00:00
refactor: remove web folder
Signed-off-by: BoHong Li <raccoon@hackmd.io>
This commit is contained in:
parent
911bd773e1
commit
b4ec353fcd
10
app.js
10
app.js
@ -153,7 +153,7 @@ server.on('resumeSession', function (id, cb) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// middleware which blocks requests when we're too busy
|
// middleware which blocks requests when we're too busy
|
||||||
app.use(require('./lib/web/middleware/tooBusy'))
|
app.use(require('./lib/middleware/tooBusy'))
|
||||||
|
|
||||||
app.use(flash())
|
app.use(flash())
|
||||||
|
|
||||||
@ -162,10 +162,10 @@ app.use(passport.initialize())
|
|||||||
app.use(passport.session())
|
app.use(passport.session())
|
||||||
|
|
||||||
// check uri is valid before going further
|
// check uri is valid before going further
|
||||||
app.use(require('./lib/web/middleware/checkURIValid'))
|
app.use(require('./lib/middleware/checkURIValid'))
|
||||||
// redirect url without trailing slashes
|
// redirect url without trailing slashes
|
||||||
app.use(require('./lib/web/middleware/redirectWithoutTrailingSlashes'))
|
app.use(require('./lib/middleware/redirectWithoutTrailingSlashes'))
|
||||||
app.use(require('./lib/web/middleware/codiMDVersion'))
|
app.use(require('./lib/middleware/codiMDVersion'))
|
||||||
|
|
||||||
// routes need sessions
|
// routes need sessions
|
||||||
// template files
|
// template files
|
||||||
@ -206,7 +206,7 @@ app.locals.enableDropBoxSave = config.isDropboxEnable
|
|||||||
app.locals.enableGitHubGist = config.isGitHubEnable
|
app.locals.enableGitHubGist = config.isGitHubEnable
|
||||||
app.locals.enableGitlabSnippets = config.isGitlabSnippetsEnable
|
app.locals.enableGitlabSnippets = config.isGitlabSnippetsEnable
|
||||||
|
|
||||||
app.use(require('./lib/web/routes').router)
|
app.use(require('./lib/routes').router)
|
||||||
|
|
||||||
// response not found if no any route matxches
|
// response not found if no any route matxches
|
||||||
app.get('*', function (req, res) {
|
app.get('*', function (req, res) {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
const Router = require('express').Router
|
const Router = require('express').Router
|
||||||
const passport = require('passport')
|
const passport = require('passport')
|
||||||
const BitbucketStrategy = require('passport-bitbucket-oauth2').Strategy
|
const BitbucketStrategy = require('passport-bitbucket-oauth2').Strategy
|
||||||
const config = require('../../../config')
|
const config = require('../../config')
|
||||||
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
||||||
|
|
||||||
const bitbucketAuth = module.exports = Router()
|
const bitbucketAuth = module.exports = Router()
|
@ -3,7 +3,7 @@
|
|||||||
const Router = require('express').Router
|
const Router = require('express').Router
|
||||||
const passport = require('passport')
|
const passport = require('passport')
|
||||||
const DropboxStrategy = require('passport-dropbox-oauth2').Strategy
|
const DropboxStrategy = require('passport-dropbox-oauth2').Strategy
|
||||||
const config = require('../../../config')
|
const config = require('../../config')
|
||||||
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
||||||
|
|
||||||
const dropboxAuth = module.exports = Router()
|
const dropboxAuth = module.exports = Router()
|
@ -4,12 +4,12 @@ const Router = require('express').Router
|
|||||||
const passport = require('passport')
|
const passport = require('passport')
|
||||||
const validator = require('validator')
|
const validator = require('validator')
|
||||||
const LocalStrategy = require('passport-local').Strategy
|
const LocalStrategy = require('passport-local').Strategy
|
||||||
const config = require('../../../config')
|
const config = require('../../config')
|
||||||
const models = require('../../../models')
|
const models = require('../../models')
|
||||||
const logger = require('../../../logger')
|
const logger = require('../../logger')
|
||||||
const { setReturnToFromReferer } = require('../utils')
|
const { setReturnToFromReferer } = require('../utils')
|
||||||
const { urlencodedParser } = require('../../utils')
|
const { urlencodedParser } = require('../../utils')
|
||||||
const response = require('../../../response')
|
const response = require('../../response')
|
||||||
|
|
||||||
const emailAuth = module.exports = Router()
|
const emailAuth = module.exports = Router()
|
||||||
|
|
@ -4,7 +4,7 @@ const Router = require('express').Router
|
|||||||
const passport = require('passport')
|
const passport = require('passport')
|
||||||
const FacebookStrategy = require('passport-facebook').Strategy
|
const FacebookStrategy = require('passport-facebook').Strategy
|
||||||
|
|
||||||
const config = require('../../../config')
|
const config = require('../../config')
|
||||||
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
||||||
|
|
||||||
const facebookAuth = module.exports = Router()
|
const facebookAuth = module.exports = Router()
|
@ -3,8 +3,8 @@
|
|||||||
const Router = require('express').Router
|
const Router = require('express').Router
|
||||||
const passport = require('passport')
|
const passport = require('passport')
|
||||||
const GithubStrategy = require('passport-github').Strategy
|
const GithubStrategy = require('passport-github').Strategy
|
||||||
const config = require('../../../config')
|
const config = require('../../config')
|
||||||
const response = require('../../../response')
|
const response = require('../../response')
|
||||||
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
||||||
const { URL } = require('url')
|
const { URL } = require('url')
|
||||||
|
|
@ -3,8 +3,8 @@
|
|||||||
const Router = require('express').Router
|
const Router = require('express').Router
|
||||||
const passport = require('passport')
|
const passport = require('passport')
|
||||||
const GitlabStrategy = require('passport-gitlab2').Strategy
|
const GitlabStrategy = require('passport-gitlab2').Strategy
|
||||||
const config = require('../../../config')
|
const config = require('../../config')
|
||||||
const response = require('../../../response')
|
const response = require('../../response')
|
||||||
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
||||||
const HttpsProxyAgent = require('https-proxy-agent')
|
const HttpsProxyAgent = require('https-proxy-agent')
|
||||||
|
|
@ -3,7 +3,7 @@
|
|||||||
const Router = require('express').Router
|
const Router = require('express').Router
|
||||||
const passport = require('passport')
|
const passport = require('passport')
|
||||||
var GoogleStrategy = require('passport-google-oauth20').Strategy
|
var GoogleStrategy = require('passport-google-oauth20').Strategy
|
||||||
const config = require('../../../config')
|
const config = require('../../config')
|
||||||
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
||||||
|
|
||||||
const googleAuth = module.exports = Router()
|
const googleAuth = module.exports = Router()
|
@ -3,9 +3,9 @@
|
|||||||
const Router = require('express').Router
|
const Router = require('express').Router
|
||||||
const passport = require('passport')
|
const passport = require('passport')
|
||||||
|
|
||||||
const config = require('../../config')
|
const config = require('../config')
|
||||||
const logger = require('../../logger')
|
const logger = require('../logger')
|
||||||
const models = require('../../models')
|
const models = require('../models')
|
||||||
|
|
||||||
const authRouter = module.exports = Router()
|
const authRouter = module.exports = Router()
|
||||||
|
|
@ -3,12 +3,12 @@
|
|||||||
const Router = require('express').Router
|
const Router = require('express').Router
|
||||||
const passport = require('passport')
|
const passport = require('passport')
|
||||||
const LDAPStrategy = require('passport-ldapauth')
|
const LDAPStrategy = require('passport-ldapauth')
|
||||||
const config = require('../../../config')
|
const config = require('../../config')
|
||||||
const models = require('../../../models')
|
const models = require('../../models')
|
||||||
const logger = require('../../../logger')
|
const logger = require('../../logger')
|
||||||
const { setReturnToFromReferer } = require('../utils')
|
const { setReturnToFromReferer } = require('../utils')
|
||||||
const { urlencodedParser } = require('../../utils')
|
const { urlencodedParser } = require('../../utils')
|
||||||
const response = require('../../../response')
|
const response = require('../../response')
|
||||||
|
|
||||||
const ldapAuth = module.exports = Router()
|
const ldapAuth = module.exports = Router()
|
||||||
|
|
@ -5,7 +5,7 @@ const Router = require('express').Router
|
|||||||
const passport = require('passport')
|
const passport = require('passport')
|
||||||
const MattermostClient = require('mattermost-redux/client/client4').default
|
const MattermostClient = require('mattermost-redux/client/client4').default
|
||||||
const OAuthStrategy = require('passport-oauth2').Strategy
|
const OAuthStrategy = require('passport-oauth2').Strategy
|
||||||
const config = require('../../../config')
|
const config = require('../../config')
|
||||||
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
||||||
|
|
||||||
const mattermostAuth = module.exports = Router()
|
const mattermostAuth = module.exports = Router()
|
@ -3,7 +3,7 @@
|
|||||||
const Router = require('express').Router
|
const Router = require('express').Router
|
||||||
const passport = require('passport')
|
const passport = require('passport')
|
||||||
const { Strategy, InternalOAuthError } = require('passport-oauth2')
|
const { Strategy, InternalOAuthError } = require('passport-oauth2')
|
||||||
const config = require('../../../config')
|
const config = require('../../config')
|
||||||
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
||||||
|
|
||||||
const oauth2Auth = module.exports = Router()
|
const oauth2Auth = module.exports = Router()
|
@ -3,9 +3,9 @@
|
|||||||
const Router = require('express').Router
|
const Router = require('express').Router
|
||||||
const passport = require('passport')
|
const passport = require('passport')
|
||||||
const OpenIDStrategy = require('@passport-next/passport-openid').Strategy
|
const OpenIDStrategy = require('@passport-next/passport-openid').Strategy
|
||||||
const config = require('../../../config')
|
const config = require('../../config')
|
||||||
const models = require('../../../models')
|
const models = require('../../models')
|
||||||
const logger = require('../../../logger')
|
const logger = require('../../logger')
|
||||||
const { urlencodedParser } = require('../../utils')
|
const { urlencodedParser } = require('../../utils')
|
||||||
const { setReturnToFromReferer } = require('../utils')
|
const { setReturnToFromReferer } = require('../utils')
|
||||||
|
|
@ -3,9 +3,9 @@
|
|||||||
const Router = require('express').Router
|
const Router = require('express').Router
|
||||||
const passport = require('passport')
|
const passport = require('passport')
|
||||||
const SamlStrategy = require('passport-saml').Strategy
|
const SamlStrategy = require('passport-saml').Strategy
|
||||||
const config = require('../../../config')
|
const config = require('../../config')
|
||||||
const models = require('../../../models')
|
const models = require('../../models')
|
||||||
const logger = require('../../../logger')
|
const logger = require('../../logger')
|
||||||
const { urlencodedParser } = require('../../utils')
|
const { urlencodedParser } = require('../../utils')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const intersection = function (array1, array2) { return array1.filter((n) => array2.includes(n)) }
|
const intersection = function (array1, array2) { return array1.filter((n) => array2.includes(n)) }
|
@ -4,7 +4,7 @@ const Router = require('express').Router
|
|||||||
const passport = require('passport')
|
const passport = require('passport')
|
||||||
const TwitterStrategy = require('passport-twitter').Strategy
|
const TwitterStrategy = require('passport-twitter').Strategy
|
||||||
|
|
||||||
const config = require('../../../config')
|
const config = require('../../config')
|
||||||
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
const { setReturnToFromReferer, passportGeneralCallback } = require('../utils')
|
||||||
|
|
||||||
const twitterAuth = module.exports = Router()
|
const twitterAuth = module.exports = Router()
|
@ -1,8 +1,8 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const models = require('../../models')
|
const models = require('../models')
|
||||||
const config = require('../../config')
|
const config = require('../config')
|
||||||
const logger = require('../../logger')
|
const logger = require('../logger')
|
||||||
|
|
||||||
exports.setReturnToFromReferer = function setReturnToFromReferer (req) {
|
exports.setReturnToFromReferer = function setReturnToFromReferer (req) {
|
||||||
var referer = req.get('referer')
|
var referer = req.get('referer')
|
@ -1,7 +1,7 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const config = require('../../config')
|
const config = require('../config')
|
||||||
const { responseError } = require('../../response')
|
const { responseError } = require('../response')
|
||||||
|
|
||||||
exports.errorForbidden = (req, res) => {
|
exports.errorForbidden = (req, res) => {
|
||||||
if (req.user) {
|
if (req.user) {
|
@ -4,10 +4,10 @@
|
|||||||
var LZString = require('@hackmd/lz-string')
|
var LZString = require('@hackmd/lz-string')
|
||||||
|
|
||||||
// core
|
// core
|
||||||
var config = require('../../config')
|
var config = require('../config')
|
||||||
var logger = require('../../logger')
|
var logger = require('../logger')
|
||||||
var response = require('../../response')
|
var response = require('../response')
|
||||||
var models = require('../../models')
|
var models = require('../models')
|
||||||
|
|
||||||
function getHistory (userid, callback) {
|
function getHistory (userid, callback) {
|
||||||
models.User.findOne({
|
models.User.findOne({
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const config = require('../../config')
|
const config = require('../config')
|
||||||
const { User } = require('../../models')
|
const { User } = require('../models')
|
||||||
const logger = require('../../logger')
|
const logger = require('../logger')
|
||||||
|
|
||||||
exports.showIndex = async (req, res) => {
|
exports.showIndex = async (req, res) => {
|
||||||
const isLogin = req.isAuthenticated()
|
const isLogin = req.isAuthenticated()
|
@ -1,8 +1,8 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const config = require('../../config')
|
const config = require('../config')
|
||||||
const logger = require('../../logger')
|
const logger = require('../logger')
|
||||||
|
|
||||||
const azure = require('azure-storage')
|
const azure = require('azure-storage')
|
||||||
|
|
@ -2,8 +2,8 @@
|
|||||||
const URL = require('url').URL
|
const URL = require('url').URL
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const config = require('../../config')
|
const config = require('../config')
|
||||||
const logger = require('../../logger')
|
const logger = require('../logger')
|
||||||
|
|
||||||
exports.uploadImage = function (imagePath, callback) {
|
exports.uploadImage = function (imagePath, callback) {
|
||||||
if (!imagePath || typeof imagePath !== 'string') {
|
if (!imagePath || typeof imagePath !== 'string') {
|
@ -1,6 +1,6 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
const config = require('../../config')
|
const config = require('../config')
|
||||||
const logger = require('../../logger')
|
const logger = require('../logger')
|
||||||
|
|
||||||
const imgur = require('@hackmd/imgur')
|
const imgur = require('@hackmd/imgur')
|
||||||
|
|
@ -3,9 +3,9 @@
|
|||||||
const Router = require('express').Router
|
const Router = require('express').Router
|
||||||
const formidable = require('formidable')
|
const formidable = require('formidable')
|
||||||
|
|
||||||
const config = require('../../config')
|
const config = require('../config')
|
||||||
const logger = require('../../logger')
|
const logger = require('../logger')
|
||||||
const response = require('../../response')
|
const response = require('../response')
|
||||||
|
|
||||||
const imageRouter = module.exports = Router()
|
const imageRouter = module.exports = Router()
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
const config = require('../../config')
|
const config = require('../config')
|
||||||
const logger = require('../../logger')
|
const logger = require('../logger')
|
||||||
|
|
||||||
const lutim = require('lutim')
|
const lutim = require('lib/imageRouter/lutim')
|
||||||
|
|
||||||
exports.uploadImage = function (imagePath, callback) {
|
exports.uploadImage = function (imagePath, callback) {
|
||||||
if (!imagePath || typeof imagePath !== 'string') {
|
if (!imagePath || typeof imagePath !== 'string') {
|
@ -2,11 +2,11 @@
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const config = require('../../config')
|
const config = require('../config')
|
||||||
const { getImageMimeType } = require('../../utils')
|
const { getImageMimeType } = require('../utils')
|
||||||
const logger = require('../../logger')
|
const logger = require('../logger')
|
||||||
|
|
||||||
const Minio = require('minio')
|
const Minio = require('lib/imageRouter/minio')
|
||||||
const minioClient = new Minio.Client({
|
const minioClient = new Minio.Client({
|
||||||
endPoint: config.minio.endPoint,
|
endPoint: config.minio.endPoint,
|
||||||
port: config.minio.port,
|
port: config.minio.port,
|
@ -2,9 +2,9 @@
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const config = require('../../config')
|
const config = require('../config')
|
||||||
const { getImageMimeType } = require('../../utils')
|
const { getImageMimeType } = require('../utils')
|
||||||
const logger = require('../../logger')
|
const logger = require('../logger')
|
||||||
|
|
||||||
const AWS = require('aws-sdk')
|
const AWS = require('aws-sdk')
|
||||||
const awsConfig = new AWS.Config(config.s3)
|
const awsConfig = new AWS.Config(config.s3)
|
@ -1,7 +1,7 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const logger = require('../../logger')
|
const logger = require('../logger')
|
||||||
const response = require('../../response')
|
const response = require('../response')
|
||||||
|
|
||||||
module.exports = function (req, res, next) {
|
module.exports = function (req, res, next) {
|
||||||
try {
|
try {
|
@ -1,6 +1,6 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const config = require('../../config')
|
const config = require('../config')
|
||||||
|
|
||||||
module.exports = function (req, res, next) {
|
module.exports = function (req, res, next) {
|
||||||
res.set({
|
res.set({
|
@ -1,6 +1,6 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const config = require('../../config')
|
const config = require('../config')
|
||||||
|
|
||||||
module.exports = function (req, res, next) {
|
module.exports = function (req, res, next) {
|
||||||
if (req.method === 'GET' && req.path.substr(-1) === '/' && req.path.length > 1) {
|
if (req.method === 'GET' && req.path.substr(-1) === '/' && req.path.length > 1) {
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
const toobusy = require('toobusy-js')
|
const toobusy = require('toobusy-js')
|
||||||
|
|
||||||
const config = require('../../config')
|
const config = require('../config')
|
||||||
const response = require('../../response')
|
const response = require('../response')
|
||||||
|
|
||||||
toobusy.maxLag(config.responseMaxLag)
|
toobusy.maxLag(config.responseMaxLag)
|
||||||
|
|
@ -14,7 +14,7 @@ const get = require('lodash/get')
|
|||||||
// core
|
// core
|
||||||
const config = require('../config')
|
const config = require('../config')
|
||||||
const logger = require('../logger')
|
const logger = require('../logger')
|
||||||
const history = require('../web/history')
|
const history = require('../history')
|
||||||
const models = require('../models')
|
const models = require('../models')
|
||||||
|
|
||||||
// ot
|
// ot
|
||||||
|
@ -14,7 +14,7 @@ const config = require('./config')
|
|||||||
const logger = require('./logger')
|
const logger = require('./logger')
|
||||||
const models = require('./models')
|
const models = require('./models')
|
||||||
const utils = require('./utils')
|
const utils = require('./utils')
|
||||||
const history = require('./web/history')
|
const history = require('./history')
|
||||||
|
|
||||||
// public
|
// public
|
||||||
exports.responseError = responseError
|
exports.responseError = responseError
|
||||||
|
@ -10,7 +10,7 @@ const errorPageController = require('./errorPage')
|
|||||||
const statusController = require('./status')
|
const statusController = require('./status')
|
||||||
const historyController = require('./history')
|
const historyController = require('./history')
|
||||||
const userController = require('./user')
|
const userController = require('./user')
|
||||||
const response = require('../response')
|
const response = require('./response')
|
||||||
const appRouter = Router()
|
const appRouter = Router()
|
||||||
|
|
||||||
// register route
|
// register route
|
@ -1,7 +1,7 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const realtime = require('../../realtime/realtime')
|
const realtime = require('../realtime/realtime')
|
||||||
const config = require('../../config')
|
const config = require('../config')
|
||||||
|
|
||||||
exports.getStatus = async (req, res) => {
|
exports.getStatus = async (req, res) => {
|
||||||
const data = await realtime.getStatus()
|
const data = await realtime.getStatus()
|
@ -3,11 +3,11 @@
|
|||||||
const archiver = require('archiver')
|
const archiver = require('archiver')
|
||||||
const async = require('async')
|
const async = require('async')
|
||||||
|
|
||||||
const response = require('../../response')
|
const response = require('../response')
|
||||||
const config = require('../../config')
|
const config = require('../config')
|
||||||
const models = require('../../models')
|
const models = require('../models')
|
||||||
const logger = require('../../logger')
|
const logger = require('../logger')
|
||||||
const { generateAvatar } = require('../../letter-avatars')
|
const { generateAvatar } = require('../letter-avatars')
|
||||||
|
|
||||||
exports.getMe = async (req, res) => {
|
exports.getMe = async (req, res) => {
|
||||||
if (!req.isAuthenticated()) {
|
if (!req.isAuthenticated()) {
|
16
lib/utils.js
16
lib/utils.js
@ -1,6 +1,7 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const bodyParser = require('body-parser')
|
||||||
|
|
||||||
exports.isSQLite = function isSQLite (sequelize) {
|
exports.isSQLite = function isSQLite (sequelize) {
|
||||||
return sequelize.options.dialect === 'sqlite'
|
return sequelize.options.dialect === 'sqlite'
|
||||||
@ -32,3 +33,18 @@ exports.isRevealTheme = function isRevealTheme (theme) {
|
|||||||
}
|
}
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.wrap = innerHandler => (req, res, next) => innerHandler(req, res).catch(err => next(err))
|
||||||
|
|
||||||
|
// create application/x-www-form-urlencoded parser
|
||||||
|
exports.urlencodedParser = bodyParser.urlencoded({
|
||||||
|
extended: false,
|
||||||
|
limit: 1024 * 1024 * 10 // 10 mb
|
||||||
|
})
|
||||||
|
|
||||||
|
// create text/markdown parser
|
||||||
|
exports.markdownParser = bodyParser.text({
|
||||||
|
inflate: true,
|
||||||
|
type: ['text/plain', 'text/markdown'],
|
||||||
|
limit: 1024 * 1024 * 10 // 10 mb
|
||||||
|
})
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
'use strict'
|
|
||||||
|
|
||||||
const bodyParser = require('body-parser')
|
|
||||||
|
|
||||||
exports.wrap = innerHandler => (req, res, next) => innerHandler(req, res).catch(err => next(err))
|
|
||||||
|
|
||||||
// create application/x-www-form-urlencoded parser
|
|
||||||
exports.urlencodedParser = bodyParser.urlencoded({
|
|
||||||
extended: false,
|
|
||||||
limit: 1024 * 1024 * 10 // 10 mb
|
|
||||||
})
|
|
||||||
|
|
||||||
// create text/markdown parser
|
|
||||||
exports.markdownParser = bodyParser.text({
|
|
||||||
inflate: true,
|
|
||||||
type: ['text/plain', 'text/markdown'],
|
|
||||||
limit: 1024 * 1024 * 10 // 10 mb
|
|
||||||
})
|
|
Loading…
x
Reference in New Issue
Block a user