You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.1 KiB
34 lines
1.1 KiB
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); |
|
|
|
module.exports = route; |