mirror of
https://github.com/Foltik/Shimapan
synced 2024-11-30 22:41:47 -05:00
Clean up routes folder
This commit is contained in:
parent
f02a4f05f4
commit
49b77c5c03
@ -2,16 +2,16 @@ const express = require('express');
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const config = require('config');
|
const config = require('config');
|
||||||
|
|
||||||
const ModelPath = '../models/';
|
const ModelPath = '../../models/';
|
||||||
const User = require(ModelPath + 'User.js');
|
const User = require(ModelPath + 'User.js');
|
||||||
const Invite = require(ModelPath + 'Invite.js');
|
const Invite = require(ModelPath + 'Invite.js');
|
||||||
|
|
||||||
const passport = require('passport');
|
const passport = require('passport');
|
||||||
|
|
||||||
const canonicalizeRequest = require('../util/canonicalize').canonicalizeRequest;
|
const canonicalizeRequest = require('../../util/canonicalize').canonicalizeRequest;
|
||||||
const requireAuth = require('../util/auth').requireAuth;
|
const requireAuth = require('../../util/auth').requireAuth;
|
||||||
const wrap = require('../util/wrap.js');
|
const wrap = require('../../util/wrap.js');
|
||||||
const verifyBody = require('../util/verifyBody');
|
const verifyBody = require('../../util/verifyBody');
|
||||||
|
|
||||||
// Wraps passport.authenticate to return a promise
|
// Wraps passport.authenticate to return a promise
|
||||||
const authenticate = (req, res, next) => {
|
const authenticate = (req, res, next) => {
|
@ -2,14 +2,14 @@ const express = require('express');
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
|
|
||||||
const ModelPath = '../models/';
|
const ModelPath = '../../models/';
|
||||||
const Invite = require(ModelPath + 'Invite.js');
|
const Invite = require(ModelPath + 'Invite.js');
|
||||||
const User = require(ModelPath + 'User.js');
|
const User = require(ModelPath + 'User.js');
|
||||||
|
|
||||||
const wrap = require('../util/wrap.js');
|
const wrap = require('../../util/wrap.js');
|
||||||
const requireAuth = require('../util/auth').requireAuth;
|
const requireAuth = require('../../util/auth').requireAuth;
|
||||||
const verifyScope = require('../util/verifyScope');
|
const verifyScope = require('../../util/verifyScope');
|
||||||
const verifyBody = require('../util/verifyBody');
|
const verifyBody = require('../../util/verifyBody');
|
||||||
|
|
||||||
|
|
||||||
const updateInviteCount = async (req, next) =>
|
const updateInviteCount = async (req, next) =>
|
@ -2,8 +2,8 @@ var express = require('express');
|
|||||||
var router = express.Router();
|
var router = express.Router();
|
||||||
var crypto = require('crypto');
|
var crypto = require('crypto');
|
||||||
|
|
||||||
var User = require('../models/User.js');
|
var User = require('../../models/User.js');
|
||||||
var Key = require('../models/Key.js');
|
var Key = require('../../models/Key.js');
|
||||||
|
|
||||||
var requireScope = function (perm) {
|
var requireScope = function (perm) {
|
||||||
return function(req, res, next) {
|
return function(req, res, next) {
|
@ -2,13 +2,13 @@ const express = require('express');
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const config = require('config');
|
const config = require('config');
|
||||||
|
|
||||||
const ModelPath = '../models/';
|
const ModelPath = '../../models/';
|
||||||
const Upload = require(ModelPath + 'Upload.js');
|
const Upload = require(ModelPath + 'Upload.js');
|
||||||
|
|
||||||
const uploadMultipart = require('../util/upload/multipart');
|
const uploadMultipart = require('../../util/upload/multipart');
|
||||||
const updateStats = require('../util/upload/stats');
|
const updateStats = require('../../util/upload/stats');
|
||||||
|
|
||||||
const wrap = require('../util/wrap.js');
|
const wrap = require('../../util/wrap.js');
|
||||||
|
|
||||||
router.post('/', uploadMultipart, wrap(async (req, res) => {
|
router.post('/', uploadMultipart, wrap(async (req, res) => {
|
||||||
const upload = {
|
const upload = {
|
@ -1,7 +1,7 @@
|
|||||||
var express = require('express');
|
var express = require('express');
|
||||||
var router = express.Router();
|
var router = express.Router();
|
||||||
|
|
||||||
var User = require('../models/User.js');
|
var User = require('../../models/User.js');
|
||||||
|
|
||||||
var requireScope = function (perm) {
|
var requireScope = function (perm) {
|
||||||
return function(req, res, next) {
|
return function(req, res, next) {
|
@ -2,10 +2,10 @@ const express = require('express');
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const config = require('config');
|
const config = require('config');
|
||||||
|
|
||||||
const ModelPath = '../models/';
|
const ModelPath = '../../models/';
|
||||||
const Upload = require(ModelPath + 'Upload.js');
|
const Upload = require(ModelPath + 'Upload.js');
|
||||||
|
|
||||||
const wrap = require('../util/wrap.js');
|
const wrap = require('../../util/wrap.js');
|
||||||
|
|
||||||
|
|
||||||
const incrementViews = async id =>
|
const incrementViews = async id =>
|
@ -1,26 +1,32 @@
|
|||||||
|
// Views
|
||||||
const index = require('./index.js');
|
const index = require('./index.js');
|
||||||
const home = require('./home.js');
|
const home = require('./home.js');
|
||||||
const upload = require('./upload.js');
|
|
||||||
const view = require('./view.js');
|
|
||||||
const auth = require('./auth.js');
|
|
||||||
const register = require('./register.js');
|
const register = require('./register.js');
|
||||||
const login = require('./login.js');
|
const login = require('./login.js');
|
||||||
const panel = require('./panel.js');
|
const panel = require('./panel.js');
|
||||||
const keys = require('./keys.js');
|
|
||||||
const invites = require('./invite.js');
|
// API
|
||||||
const users = require('./users.js');
|
const auth = require('./api/auth.js');
|
||||||
|
const upload = require('./api/upload.js');
|
||||||
|
const view = require('./api/view.js');
|
||||||
|
const invites = require('./api/invites.js');
|
||||||
|
const keys = require('./api/keys.js');
|
||||||
|
const users = require('./api/users.js');
|
||||||
|
|
||||||
module.exports = function (app) {
|
module.exports = function (app) {
|
||||||
app.use('/', index);
|
app.use('/', index);
|
||||||
app.use('/home', home);
|
app.use('/home', home);
|
||||||
app.use('/v', view);
|
|
||||||
app.use('/api/upload', upload);
|
|
||||||
app.use('/api/auth', auth);
|
|
||||||
app.use('/api/keys', keys);
|
|
||||||
app.use('/api/invites', invites);
|
|
||||||
app.use('/api/users', users);
|
|
||||||
app.use('/register', register);
|
app.use('/register', register);
|
||||||
app.use('/login', login);
|
app.use('/login', login);
|
||||||
app.use('/panel', panel);
|
app.use('/panel', panel);
|
||||||
app.use('/panel*', panel);
|
app.use('/panel*', panel);
|
||||||
|
|
||||||
|
|
||||||
|
app.use('/api/auth', auth);
|
||||||
|
app.use('/api/upload', upload);
|
||||||
|
app.use('/v', view);
|
||||||
|
app.use('/api/view', view);
|
||||||
|
app.use('/api/invites', invites);
|
||||||
|
app.use('/api/keys', keys);
|
||||||
|
app.use('/api/users', users);
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user