reset password
This commit is contained in:
parent
899eaf202a
commit
f7e4775ed3
@ -1,12 +1,14 @@
|
|||||||
const express = require("express");
|
const express = require("express");
|
||||||
const { rateLimit } = require("express-rate-limit");
|
const { rateLimit } = require("express-rate-limit");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
const router = require('./routes/user');
|
||||||
|
const errorHandler = require('./utils/errorHandler');
|
||||||
const app = express();
|
const app = express();
|
||||||
const ejs = require("ejs");
|
const ejs = require("ejs");
|
||||||
|
|
||||||
module.exports = app;
|
module.exports = app;
|
||||||
|
|
||||||
process.nextTick(() => require("./mqttApp"));
|
//process.nextTick(() => require("./mqttApp"));
|
||||||
|
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
app.set("json spaces", 2);
|
app.set("json spaces", 2);
|
||||||
@ -68,6 +70,7 @@ app.use(function (err, req, res, next) {
|
|||||||
keyErrors[item.path] = item.message;
|
keyErrors[item.path] = item.message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
res.status = 422;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (![404, 401, 422].includes(err.status || res.status)) {
|
if (![404, 401, 422].includes(err.status || res.status)) {
|
||||||
@ -76,6 +79,7 @@ app.use(function (err, req, res, next) {
|
|||||||
console.error("=========================================");
|
console.error("=========================================");
|
||||||
}
|
}
|
||||||
res.status(err.status || 500);
|
res.status(err.status || 500);
|
||||||
|
// res.status(err.status || 500);
|
||||||
|
|
||||||
if (req.get('Content-Type') && req.get('Content-Type').includes("json")) {
|
if (req.get('Content-Type') && req.get('Content-Type').includes("json")) {
|
||||||
res.json({
|
res.json({
|
||||||
@ -91,4 +95,15 @@ app.use(function (err, req, res, next) {
|
|||||||
keyErrors,
|
keyErrors,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//reset password logic
|
||||||
|
app.use("/api/user", router)
|
||||||
|
|
||||||
|
app.use(errorHandler);
|
||||||
|
|
||||||
|
const PORT = 3000;
|
||||||
|
|
||||||
|
app.listen(PORT, () => {
|
||||||
|
console.log('server running on port ' + PORT);
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user