|
|
|
const express = require("express");
|
|
|
|
const route = express.Router();
|
|
|
|
const { protect, protectAtlogin } = require("../Middleware/auth");
|
|
|
|
const controller = require("../Controller/Authentication");
|
|
|
|
const appVersion = require("../Controller/App_Versions")
|
|
|
|
const multer = require('multer')
|
|
|
|
const moment = require('moment')
|
|
|
|
|
|
|
|
var storage = multer.diskStorage({
|
|
|
|
destination: function (req, file, cb) {
|
|
|
|
if (file.fieldname == "photo") cb(null, "upload/user/tmp_post");
|
|
|
|
},
|
|
|
|
filename: function (req, file, cb) {
|
|
|
|
cb(
|
|
|
|
null,
|
|
|
|
moment(Date.now()).format("YYYY-MM-DD_HH-mm-ss_") + file.originalname
|
|
|
|
);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
var upload = multer({ storage: storage });
|
|
|
|
|
|
|
|
|
|
|
|
route.route("/login").post(protectAtlogin, controller.login);
|
|
|
|
|
|
|
|
route.route("/appversion").get(appVersion.getAppVersion);
|
|
|
|
|
|
|
|
route.route("/checkusername").get(protectAtlogin, controller.checkUsername);
|
|
|
|
|
|
|
|
route.route("/register").post(upload.single("user_image"), controller.register,);
|
|
|
|
|
|
|
|
route.route("/checkExistUsername").get(protectAtlogin, controller.checkExistingUsername);
|
|
|
|
|
|
|
|
route.route("/getconnction").get(protect, controller.getconnection);
|
|
|
|
|
|
|
|
module.exports = route;
|