Compare commits
20 Commits
v1.0.1
...
b8275a4c8f
| Author | SHA1 | Date | |
|---|---|---|---|
| b8275a4c8f | |||
| fb868bfefc | |||
| 086c94c58a | |||
| 812a95dd85 | |||
| 85ee64e92b | |||
|
|
eb87f400ee | ||
| 92cabfa048 | |||
|
|
b2a853e183 | ||
|
|
0a6d50cb60 | ||
| 7809806b83 | |||
|
|
1aa0c36c84 | ||
|
|
7c3132c54b | ||
| 8fc85a7de8 | |||
|
|
cb8b2cc5aa | ||
| 6651215eeb | |||
| 80f8cef142 | |||
|
|
5a57291523 | ||
|
|
39ab269f07 | ||
| 7cb23080bf | |||
| d74e4a8624 |
@@ -1,14 +1,16 @@
|
||||
FROM 'node:18'
|
||||
FROM node:18
|
||||
|
||||
RUN mkdir -p /usr/src/app/server/
|
||||
WORKDIR /usr/src/app/
|
||||
|
||||
COPY ./server /usr/src/app/server
|
||||
COPY ./package.json /usr/src/app/package.json
|
||||
COPY ./package-lock.json /usr/src/app/package-lock.json
|
||||
COPY ./.serverrc.js /usr/src/app/.serverrc.js
|
||||
# COPY ./.env /usr/src/app/.env
|
||||
|
||||
RUN npm i --only=prod
|
||||
# RUN npm i --omit=dev
|
||||
RUN npm ci
|
||||
EXPOSE 8044
|
||||
|
||||
CMD ["npm", "run", "up:prod"]
|
||||
|
||||
79
package-lock.json
generated
79
package-lock.json
generated
@@ -9,7 +9,6 @@
|
||||
"version": "1.0.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/express": "^4.17.21",
|
||||
"bcrypt": "^5.1.0",
|
||||
"body-parser": "^1.19.0",
|
||||
"cookie-parser": "^1.4.5",
|
||||
@@ -279,23 +278,6 @@
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/body-parser": {
|
||||
"version": "1.19.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz",
|
||||
"integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==",
|
||||
"dependencies": {
|
||||
"@types/connect": "*",
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/connect": {
|
||||
"version": "3.4.38",
|
||||
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz",
|
||||
"integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==",
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/cookie": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz",
|
||||
@@ -309,33 +291,6 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/express": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz",
|
||||
"integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==",
|
||||
"dependencies": {
|
||||
"@types/body-parser": "*",
|
||||
"@types/express-serve-static-core": "^4.17.33",
|
||||
"@types/qs": "*",
|
||||
"@types/serve-static": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/express-serve-static-core": {
|
||||
"version": "4.17.41",
|
||||
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.41.tgz",
|
||||
"integrity": "sha512-OaJ7XLaelTgrvlZD8/aa0vvvxZdUmlCn6MtWeB7TkiKW70BQLc9XEPpDLPdbo52ZhXUCrznlWdCHWxJWtdyajA==",
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"@types/qs": "*",
|
||||
"@types/range-parser": "*",
|
||||
"@types/send": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/http-errors": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz",
|
||||
"integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA=="
|
||||
},
|
||||
"node_modules/@types/json5": {
|
||||
"version": "0.0.29",
|
||||
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
|
||||
@@ -350,45 +305,11 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/mime": {
|
||||
"version": "1.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz",
|
||||
"integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w=="
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "18.17.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.17.1.tgz",
|
||||
"integrity": "sha512-xlR1jahfizdplZYRU59JlUx9uzF1ARa8jbhM11ccpCJya8kvos5jwdm2ZAgxSCwOl0fq21svP18EVwPBXMQudw=="
|
||||
},
|
||||
"node_modules/@types/qs": {
|
||||
"version": "6.9.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.10.tgz",
|
||||
"integrity": "sha512-3Gnx08Ns1sEoCrWssEgTSJs/rsT2vhGP+Ja9cnnk9k4ALxinORlQneLXFeFKOTJMOeZUFD1s7w+w2AphTpvzZw=="
|
||||
},
|
||||
"node_modules/@types/range-parser": {
|
||||
"version": "1.2.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz",
|
||||
"integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ=="
|
||||
},
|
||||
"node_modules/@types/send": {
|
||||
"version": "0.17.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz",
|
||||
"integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==",
|
||||
"dependencies": {
|
||||
"@types/mime": "^1",
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/serve-static": {
|
||||
"version": "1.15.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.5.tgz",
|
||||
"integrity": "sha512-PDRk21MnK70hja/YF8AHfC7yIsiQHn1rcXx7ijCFBX/k+XQJhQT/gw3xekXKJvx+5SXaMMS8oqQy09Mzvz2TuQ==",
|
||||
"dependencies": {
|
||||
"@types/http-errors": "*",
|
||||
"@types/mime": "*",
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/abab": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz",
|
||||
|
||||
@@ -55,6 +55,11 @@ app.use('/example', require('./routers/example'))
|
||||
// app.use('/task-boss', require('./routers/task-boss'))
|
||||
// app.use('/car-wash', require('./routers/car-wash'))
|
||||
app.use('/zoom-bar', require('./routers/zoom-bar'))
|
||||
app.use('/r-and-m', require('./routers/r-and-m'))
|
||||
app.use('/my', require('./routers/my'))
|
||||
app.use('/edateam', require('./routers/edateam'))
|
||||
app.use('/webstar-project', require('./routers/webstar-project'))
|
||||
app.use('/dogsitters-finder', require('./routers/dogsitters-finder'))
|
||||
//app.use('/basket', require('./routers/basket'))
|
||||
//app.use('/easy-project', require('./routers/easy-project'))
|
||||
//app.use('/sugarbun', require('./routers/sugarbun'))
|
||||
|
||||
9
server/routers/dogsitters-finder/index.js
Normal file
9
server/routers/dogsitters-finder/index.js
Normal file
@@ -0,0 +1,9 @@
|
||||
const { response } = require('express');
|
||||
|
||||
const router = require('express').Router();
|
||||
|
||||
router.get("/users", (request, response) => {
|
||||
response.send(require("./json/users.json"))
|
||||
})
|
||||
|
||||
module.exports = router;
|
||||
43
server/routers/dogsitters-finder/json/users.json
Normal file
43
server/routers/dogsitters-finder/json/users.json
Normal file
@@ -0,0 +1,43 @@
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"phone_number": 89283244141,
|
||||
"password": "1234",
|
||||
"first_name": "Вася",
|
||||
"second_name": "Пупкин",
|
||||
"role": "dogsitter",
|
||||
"location": "Россия, республика Татарстан, Казань, улица Пушкина, 12",
|
||||
"price": 1500,
|
||||
"about_me": "Я люблю собак"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"phone_number": 89272844541,
|
||||
"password": "1234",
|
||||
"first_name": "Ваня",
|
||||
"second_name": "Пуськин",
|
||||
"role": "dogsitter",
|
||||
"location": "Россия, республика Татарстан, Казань, улица Абсалямова, 19",
|
||||
"price": 1000000,
|
||||
"about_me": "Я не люблю собак. И вообще я котоман."
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"phone_number": 89872855893,
|
||||
"password": "12345",
|
||||
"first_name": "Гадий",
|
||||
"second_name": "Петрович",
|
||||
"role": "owner"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"phone_number": 89872844591,
|
||||
"password": "12345",
|
||||
"first_name": "Галкин",
|
||||
"second_name": "Максим",
|
||||
"role": ["owner", "dogsitter"],
|
||||
"location": "Россия, республика Татарстан, Казань, проспект Ямашева, 83",
|
||||
"price": 1000000,
|
||||
"about_me": "Миллион алых роз"
|
||||
}
|
||||
]
|
||||
36
server/routers/edateam/auth.js
Normal file
36
server/routers/edateam/auth.js
Normal file
@@ -0,0 +1,36 @@
|
||||
const router = require('express').Router();
|
||||
const checkPassword = require('pbkdf2-password')();
|
||||
const jwt = require('jsonwebtoken');
|
||||
const {EDATEAM_JWT_TOKEN} = require('./key');
|
||||
|
||||
const {getUser, _idToId, getResponse, requiredFields, signUp} = require('./controllers');
|
||||
|
||||
router.post('/sign-in', requiredFields(['email','password']), async (req, res)=>{
|
||||
try{
|
||||
const user = await getUser(req.body);
|
||||
|
||||
checkPassword({password:req.body.password, salt:user.salt},async(err, pass, salt, hash )=>{
|
||||
if(err){
|
||||
throw new Error(err);
|
||||
}
|
||||
|
||||
if(user.password === hash){
|
||||
const {password, salt:_salt, ...rest} = user;
|
||||
const token = jwt.sign(_idToId(rest), EDATEAM_JWT_TOKEN);
|
||||
return res.send(getResponse(null, token));
|
||||
}
|
||||
return res.status(400).send(getResponse('Wrong email or password!'));
|
||||
} )
|
||||
}
|
||||
catch(error){
|
||||
res.status(400).send(getResponse(error.message));
|
||||
}
|
||||
});
|
||||
|
||||
router.post('/sign-up', requiredFields(['email', 'login', 'password']), async (req, res) => {
|
||||
let error = null
|
||||
const data = await signUp(req.body).catch((e) => error = e.message)
|
||||
return res.status(error ? 400 : 200).send(getResponse(error, data))
|
||||
})
|
||||
|
||||
module.exports = router;
|
||||
217
server/routers/edateam/controllers.js
Normal file
217
server/routers/edateam/controllers.js
Normal file
@@ -0,0 +1,217 @@
|
||||
const ObjectId = require('mongodb').ObjectId;
|
||||
const getHash = require('pbkdf2-password')();
|
||||
const { getDB } = require('../../utils/mongo');
|
||||
|
||||
const USERS_COLLECTION = 'users';
|
||||
const RECIPES_COLLECTION = 'recipes_collection';
|
||||
const FAVORITES_USER = 'favorites_user'
|
||||
let db =null;
|
||||
|
||||
const connect = async () => {
|
||||
db = await getDB('edateam');
|
||||
};
|
||||
|
||||
const init = async () => {
|
||||
await connect();
|
||||
};
|
||||
|
||||
init();
|
||||
|
||||
const _idToId = (data) => {
|
||||
const { _id, ...rest } = data;
|
||||
return {
|
||||
id: _id,
|
||||
...rest
|
||||
};
|
||||
}
|
||||
|
||||
const _idToArray = (data) => {
|
||||
const _idToMap = data.map((item) => _idToId(item));
|
||||
return _idToMap;
|
||||
}
|
||||
|
||||
const getResponse = (error, data, success = true) => {
|
||||
if (error) {
|
||||
return {
|
||||
success: false,
|
||||
error,
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
success,
|
||||
data,
|
||||
}
|
||||
}
|
||||
|
||||
const signUp = async ({ email, login, password }) => {
|
||||
try {
|
||||
db = await getDB('edateam');
|
||||
const userCollection = db.collection(USERS_COLLECTION);
|
||||
|
||||
const userData = await userCollection.findOne({
|
||||
$or: [
|
||||
{ login },
|
||||
{ email }
|
||||
]
|
||||
})
|
||||
|
||||
if (userData?.login === login) {
|
||||
throw new Error('This login already in db!\nPlease come up with another login!');
|
||||
}
|
||||
|
||||
if (userData?.email === email) {
|
||||
throw new Error('This email already in db!\nPlease come up with another email!');
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
getHash({ password }, async (err, pass, salt, hash) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
const insertedCount = await userCollection.insertOne({ email, login, password: hash, salt });
|
||||
|
||||
if (!insertedCount) {
|
||||
return reject(new Error('Insert error!'));
|
||||
}
|
||||
resolve({});
|
||||
});
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
const getUser = async ({ email }) => {
|
||||
if (db === null) {
|
||||
throw new Error('no db connection :((');
|
||||
}
|
||||
|
||||
try {
|
||||
const userCollection = db.collection(USERS_COLLECTION);
|
||||
const userData = await userCollection.findOne({ email });
|
||||
if (userData) {
|
||||
return userData;
|
||||
}
|
||||
throw new Error('Wrong email or password!');
|
||||
} catch (error) {
|
||||
throw new Error(error);
|
||||
}
|
||||
}
|
||||
|
||||
const getListRecipes = async () => {
|
||||
try {
|
||||
db = await getDB('edateam');
|
||||
const recipesCollection = db.collection(RECIPES_COLLECTION);
|
||||
const recipesData = await recipesCollection.find().toArray();
|
||||
|
||||
if (recipesData.length > 0) {
|
||||
return _idToArray(recipesData);
|
||||
} else {
|
||||
throw new Error('No recipes found in the database!');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error in getListRecipes:', error.message);
|
||||
throw new Error(error.message);
|
||||
}
|
||||
};
|
||||
|
||||
const getRecipe = async (dishId ) => {
|
||||
try {
|
||||
db = await getDB('edateam');
|
||||
const recipesCollection = db.collection(RECIPES_COLLECTION);
|
||||
const id = dishId.id;
|
||||
const recipeData = await recipesCollection.findOne({ _id :new ObjectId(id) } );
|
||||
if (recipeData!=null) {
|
||||
return _idToId(recipeData);
|
||||
}
|
||||
|
||||
throw new Error('Not found recipe');
|
||||
} catch (error) {
|
||||
throw new Error(error);
|
||||
}
|
||||
}
|
||||
|
||||
const addRecipe = async (recipe) => {
|
||||
try {
|
||||
db = await getDB('edateam');
|
||||
const recipesCollection = db.collection(RECIPES_COLLECTION);
|
||||
const result = await recipesCollection.insertOne(recipe);
|
||||
|
||||
if (!result.insertedId) {
|
||||
throw new Error('Recipe insertion failed');
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
id: result.insertedId
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('Error in addRecipe:', error.message);
|
||||
throw new Error(error.message);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const requiredFields = (fields) => (req, res, next) => {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const fieldName of fields) {
|
||||
if (!req.body[fieldName]) {
|
||||
throw new Error(`Параметр ${fieldName} не установлен`)
|
||||
}
|
||||
}
|
||||
|
||||
next()
|
||||
}
|
||||
|
||||
const addFavorite = async (userId, recipeId) => {
|
||||
|
||||
try {
|
||||
db = await getDB('edateam');
|
||||
const favoritesCollection = db.collection(FAVORITES_USER);
|
||||
const result = await favoritesCollection.updateOne(
|
||||
{ userId: new ObjectId(userId) },
|
||||
{ $addToSet: { favorites: new ObjectId(recipeId) } },
|
||||
{ upsert: true }
|
||||
);
|
||||
return result;
|
||||
} catch (error) {
|
||||
throw new Error('Error adding favorite: ' + error.message);
|
||||
}
|
||||
};
|
||||
|
||||
const getFavorites = async (userId) => {
|
||||
try {
|
||||
db = await getDB('edateam');
|
||||
const favoritesCollection = db.collection(FAVORITES_USER);
|
||||
const userFavorites = await favoritesCollection.findOne({ userId: new ObjectId(userId) });
|
||||
|
||||
if (!userFavorites || !userFavorites.favorites || userFavorites.favorites.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const recipesCollection = db.collection(RECIPES_COLLECTION);
|
||||
const favoriteRecipes = await recipesCollection.find({ _id: { $in: userFavorites.favorites } }).toArray();
|
||||
|
||||
return favoriteRecipes;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw new Error("Failed to get user favorites with recipes");
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getUser,
|
||||
signUp,
|
||||
getResponse,
|
||||
_idToId,
|
||||
_idToArray,
|
||||
getListRecipes,
|
||||
getRecipe,
|
||||
addRecipe,
|
||||
requiredFields,
|
||||
getFavorites,
|
||||
addFavorite
|
||||
};
|
||||
25
server/routers/edateam/index.js
Normal file
25
server/routers/edateam/index.js
Normal file
@@ -0,0 +1,25 @@
|
||||
const router = require('express').Router();
|
||||
|
||||
router.get('/recipe-data', (request, response) => {
|
||||
response.send(require('../json/recipe-data/success.json'));
|
||||
});
|
||||
|
||||
router.get('/userpage-data', (req, res) => {
|
||||
res.send(require('../json/userpage-data/success.json'));
|
||||
});
|
||||
|
||||
router.post('/userpage-data', (req, res) => {
|
||||
res.send(require('../json/userpage-data/success.json'));
|
||||
});
|
||||
|
||||
router.get('/homepage-data', (req, res) => {
|
||||
res.send(require('../json/homepage-data/success.json'));
|
||||
});
|
||||
|
||||
router.use('/auth', require('./auth'));
|
||||
|
||||
router.use('/recipe', require('./user'));
|
||||
|
||||
router.use('/main', require('./main'));
|
||||
|
||||
module.exports = router;
|
||||
76
server/routers/edateam/json/homepage-data/success.json
Normal file
76
server/routers/edateam/json/homepage-data/success.json
Normal file
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"src": "pancakes_meat",
|
||||
"alt": "Фотография блинчиков с мясом, сыром и луком",
|
||||
"href": "?=dish01",
|
||||
"name": "Блинчики с мясом, сыром и лучком"
|
||||
},
|
||||
{
|
||||
"src": "cheesecakes",
|
||||
"alt": "Фотография сырников из творога",
|
||||
"href": "?=dish02",
|
||||
"name": "Сырники из творога"
|
||||
},
|
||||
{
|
||||
"src": "borsch",
|
||||
"alt": "Фотография борща",
|
||||
"href": "?=dish03",
|
||||
"name": "Борщ"
|
||||
},
|
||||
{
|
||||
"src": "vareniki",
|
||||
"alt": "Фотография вареников",
|
||||
"href": "?=dish04",
|
||||
"name": "Ленивые вареники"
|
||||
},
|
||||
{
|
||||
"src": "rice_porridge",
|
||||
"alt": "Фотография рисовой каши",
|
||||
"href": "?=dish05",
|
||||
"name": "Рисовая каша"
|
||||
},
|
||||
{
|
||||
"src": "cutlets",
|
||||
"alt": "Фотография котлет по-киевски",
|
||||
"href": "?=dish06",
|
||||
"name": "Котлеты по-киевски"
|
||||
},
|
||||
{
|
||||
"src": "draniki",
|
||||
"alt": "Фотография драников",
|
||||
"href": "?=dish07",
|
||||
"name": "Драники"
|
||||
},
|
||||
{
|
||||
"src": "meringue",
|
||||
"alt": "Фотография безе",
|
||||
"href": "?=dish08",
|
||||
"name": "Безе"
|
||||
},
|
||||
{
|
||||
"src": "goulash",
|
||||
"alt": "Фотография гуляша",
|
||||
"href": "?=dish09",
|
||||
"name": "Гуляш"
|
||||
},
|
||||
{
|
||||
"src": "pancakes_cherries",
|
||||
"alt": "Фотография блинчиков с вишней и творожным сыром",
|
||||
"href": "?=dish10",
|
||||
"name": "Блинчики с вишней и творожным сыром"
|
||||
},
|
||||
{
|
||||
"src": "canned_soup",
|
||||
"alt": "Фотография супа из рыбных консервов",
|
||||
"href": "?=dish11",
|
||||
"name": "Суп из рыбных консервов"
|
||||
},
|
||||
{
|
||||
"src": "salad",
|
||||
"alt": "Фотография салата",
|
||||
"href": "?=dish12",
|
||||
"name": "Салат \"Весенний\""
|
||||
}
|
||||
]
|
||||
}
|
||||
58
server/routers/edateam/json/recipe-data/success.json
Normal file
58
server/routers/edateam/json/recipe-data/success.json
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"name":"Блинчики с вишней и творожным сыром",
|
||||
|
||||
"stages":
|
||||
[
|
||||
"Смешать муку, молоко, яйца, сахар и соль в миске",
|
||||
"Добавить вишню в тесто и перемешать",
|
||||
"Вылить тесто на разогретую сковороду и обжарить с двух сторон до золотистого цвета",
|
||||
"Подавать блинчики, украсив творожным сыром сверху"
|
||||
],
|
||||
|
||||
"table":
|
||||
[
|
||||
{ "ingredient": "1",
|
||||
"weight": "500 гр",
|
||||
"price1": "500р.",
|
||||
"price2": "439р.",
|
||||
"price3": "600р." },
|
||||
|
||||
{ "ingredient": "Ингредиент 2",
|
||||
"weight": "2 шт",
|
||||
"price1": "120р.",
|
||||
"price2": "150р.",
|
||||
"price3": "130р." },
|
||||
|
||||
{ "ingredient": "Ингредиент 3",
|
||||
"weight": "500 гр",
|
||||
"price1": "12р.",
|
||||
"price2": "12.99р.",
|
||||
"price3": "10р." },
|
||||
|
||||
{ "ingredient": "Ингредиент 4",
|
||||
"weight": "500 гр",
|
||||
"price1": "500р.",
|
||||
"price2": "439р.",
|
||||
"price3": "600р." },
|
||||
|
||||
{ "ingredient": "Ингредиент 5",
|
||||
"weight": "500 гр",
|
||||
"price1": "500р.",
|
||||
"price2": "439р.",
|
||||
"price3": "600р." },
|
||||
|
||||
{ "ingredient": "Ингредиент 6",
|
||||
"weight": "500 гр",
|
||||
"price1": "500р.",
|
||||
"price2": "439р.",
|
||||
"price3": "600р." }
|
||||
],
|
||||
|
||||
"tags":
|
||||
[
|
||||
{ "name": "#блины", "href": "#01" },
|
||||
{ "name": "#вишня", "href": "#02" },
|
||||
{ "name": "#молоко"," href": "#03" }
|
||||
]
|
||||
|
||||
}
|
||||
30
server/routers/edateam/json/userpage-data/success.json
Normal file
30
server/routers/edateam/json/userpage-data/success.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"data":{
|
||||
"id":1,
|
||||
"loginname":"Логин пользователя",
|
||||
"datesignin":"2024/05/18",
|
||||
"favoritedishes":
|
||||
[
|
||||
{"id":1,
|
||||
"dishlink":"?=dish1",
|
||||
"dishname":"Блюдо1"
|
||||
},
|
||||
{"id":2,
|
||||
"dishlink":"?=dish2",
|
||||
"dishname":"Блюдо2"
|
||||
},
|
||||
{"id":3,
|
||||
"dishlink":"?=dish3",
|
||||
"dishname":"Блюдо3"
|
||||
},
|
||||
{"id":4,
|
||||
"dishlink":"?=dish4",
|
||||
"dishname":"Блюдо4"
|
||||
},
|
||||
{"id":5,
|
||||
"dishlink":"?=dish5",
|
||||
"dishname":"Блюдо5"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
3
server/routers/edateam/key.js
Normal file
3
server/routers/edateam/key.js
Normal file
@@ -0,0 +1,3 @@
|
||||
const EDATEAM_JWT_TOKEN = 'secretyk token';
|
||||
|
||||
module.exports = {EDATEAM_JWT_TOKEN};
|
||||
51
server/routers/edateam/main.js
Normal file
51
server/routers/edateam/main.js
Normal file
@@ -0,0 +1,51 @@
|
||||
const { getListRecipes , getRecipe, addFavorite , getFavorites} = require('./controllers');
|
||||
|
||||
const router = require('express').Router();
|
||||
|
||||
router.get('/recipes', async (req, res) => {
|
||||
try {
|
||||
const result = await getListRecipes();
|
||||
return res.status(200).json({ success: true, data: result });
|
||||
} catch (error) {
|
||||
console.error('Error in GET /recipes:', error.message);
|
||||
return res.status(500).json({ success: false, message: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
router.post('/recipe', async(req,res)=>{
|
||||
try{
|
||||
const result = await getRecipe(req.body);
|
||||
|
||||
return res.status(200).json({success:true, data: result});
|
||||
}
|
||||
catch(error){
|
||||
console.error('Error in GET /recipes:', error.message);
|
||||
return res.status(500).json({ success: false, message: error.message });
|
||||
}
|
||||
})
|
||||
|
||||
router.post('/favorites', async (req, res) => {
|
||||
try {
|
||||
|
||||
const { userId, recipeId } = req.body;
|
||||
const result = await addFavorite(userId, recipeId);
|
||||
return res.status(200).json({ success: true, data: result });
|
||||
} catch (error) {
|
||||
console.error('Error in POST /favorites:', error.message);
|
||||
return res.status(500).json({ success: false, message: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
router.post('/get-favorites', async(req,res) =>{
|
||||
try {
|
||||
const { userId } = req.body;
|
||||
const result = await getFavorites(userId);
|
||||
console.log(result)
|
||||
return res.status(200).json({ success: true, data: result });
|
||||
} catch (error) {
|
||||
console.error('Error in POST /get-favorites:', error.message);
|
||||
return res.status(500).json({ success: false, message: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
35
server/routers/edateam/user.js
Normal file
35
server/routers/edateam/user.js
Normal file
@@ -0,0 +1,35 @@
|
||||
const { requiredFields , getFavorites, addRecipe} = require('./controllers');
|
||||
|
||||
const router = require('express').Router();
|
||||
|
||||
router.post('/favorites', requiredFields('id'), async(req,res)=>{
|
||||
try{
|
||||
const recipes = await getFavorites(req.body);
|
||||
res.status(200).send(getResponse(recipes));
|
||||
}
|
||||
catch(error){
|
||||
res.status(400).send(getResponse(error.message));
|
||||
}
|
||||
})
|
||||
|
||||
router.post('/add-recept', async (req, res) => {
|
||||
let error = null;
|
||||
let result = null;
|
||||
|
||||
try {
|
||||
result = await addRecipe(req.body);
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
console.error(`Error in POST /add-recept: ${error}`);
|
||||
}
|
||||
|
||||
return res.status(error ? 500 : 201).json({
|
||||
message: error ? error : 'Recipe added successfully',
|
||||
id: result?.id
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
30
server/routers/my/index.js
Normal file
30
server/routers/my/index.js
Normal file
@@ -0,0 +1,30 @@
|
||||
const router = require('express').Router();
|
||||
|
||||
router.get('/catalog-data', (request, response) => {
|
||||
response.send(require('./stubs/json/catalog-data/success.json'))
|
||||
})
|
||||
|
||||
router.get('/item-data', (request, response) => {
|
||||
response.send(require('./stubs/json/catalog-data/newsuccess.json'))
|
||||
})
|
||||
router.post('/search', (request, response) => {
|
||||
const searchTerm = request.body.search.toLowerCase();
|
||||
|
||||
try {
|
||||
const itemsData = require('./stubs/json/catalog-data/newsuccess.json');
|
||||
const itemData = itemsData.data.find(item => item.name.toLowerCase().includes(searchTerm));
|
||||
|
||||
if (itemData) {
|
||||
return response.json({ data: itemData });
|
||||
} else {
|
||||
console.log('Item not found');
|
||||
return response.status(404).send('Item not found');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error reading file:', error);
|
||||
return response.status(500).send('Internal server error');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
module.exports = router;
|
||||
52
server/routers/my/json/catalog-data/success.json
Normal file
52
server/routers/my/json/catalog-data/success.json
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"data":[
|
||||
[{
|
||||
"id": 1,
|
||||
"photo": "shirt7_1x",
|
||||
"alt" :"ФУТБОЛКА 'ЧЕРНОЕ МОРЕ'",
|
||||
"name": "ФУТБОЛКА 'ЧЕРНОЕ МОРЕ'",
|
||||
"price": "1500 руб.",
|
||||
"setphoto": ["shirt7_1x","shirt7_2x","shirt7_4x"]
|
||||
},
|
||||
{
|
||||
"id":2,
|
||||
"photo": "shirt8_1x",
|
||||
"alt" :"ЗИП МУЖСКОЙ",
|
||||
"name": "ЗИП МУЖСКОЙ",
|
||||
"price": "1500 руб.",
|
||||
"setphoto": ["shirt8_1x","shirt8_2x","shirt8_4x"]
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"photo": "shirt1_1x",
|
||||
"alt" :"Фотография футболки белого цвета с цитатой из К/ф Кавказская пленница",
|
||||
"name": "ФУТБОЛКА С ПРИНТОМ МОСФИЛЬМ",
|
||||
"price": "1500 руб.",
|
||||
"setphoto": ["shirt1_1x","shirt1_2x","shirt1_4x"]
|
||||
}],
|
||||
[{
|
||||
"id": 4,
|
||||
"photo": "shirt9_1x",
|
||||
"alt" :"ЛАВАНДОВОЕ ХУДИ",
|
||||
"name": "ЛАВАНДОВОЕ ХУДИ",
|
||||
"price": "1500 руб.",
|
||||
"setphoto": ["shirt9_1x","shirt9_2x","shirt9_4x"]
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"photo": "shirt10_1x",
|
||||
"alt" :"ФУТБОЛКА АНИМЕ",
|
||||
"name": "ФУТБОЛКА АНИМЕ",
|
||||
"price": "1500 руб.",
|
||||
"setphoto": ["shirt10_1x","shirt10_2x","shirt10_4x"]
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"photo":"shirt11_1x",
|
||||
"alt" :"ФУТБОЛКА ОВЕРСАЙЗ С ПРИНТОМ ЭРАРТА",
|
||||
"name": "ФУТБОЛКА ОВЕРСАЙЗ С ПРИНТОМ ЭРАРТА",
|
||||
"price": "1500 руб.",
|
||||
"setphoto": ["shirt11_1x","shirt11_2x", "shirt11_4x"]
|
||||
}]
|
||||
]
|
||||
}
|
||||
179
server/routers/my/json/item-data/newsuccess.json
Normal file
179
server/routers/my/json/item-data/newsuccess.json
Normal file
@@ -0,0 +1,179 @@
|
||||
{
|
||||
"data":[
|
||||
{
|
||||
"id": 1,
|
||||
"photo": ["shirt7_1x", "shirt7_1_1x"],
|
||||
"alt" :"ФУТБОЛКА 'ЧЕРНОЕ МОРЕ'",
|
||||
"name": "ФУТБОЛКА 'ЧЕРНОЕ МОРЕ'",
|
||||
"price": "1500 руб.",
|
||||
"color" : "Серый",
|
||||
"colorid" : 7,
|
||||
"colorcss": ["#606060","#FFFFFF"],
|
||||
"setphoto": ["shirt7_1x","shirt7_1_1x","shirt7_2x","shirt7_1_2x", "shirt7_4x", "shirt7_1_4x"],
|
||||
"size": ["XS/S","M/L","XL/XLL"],
|
||||
"body": ["79653",
|
||||
"Весна-Лето 2023",
|
||||
"Черное море",
|
||||
"без застежки",
|
||||
"светло-серый",
|
||||
"100% Хлопок",
|
||||
"свободный",
|
||||
"картина",
|
||||
"удлиненная",
|
||||
"101-78-96",
|
||||
"178",
|
||||
"M (48)",
|
||||
"без карманов",
|
||||
"160",
|
||||
"Женский"]
|
||||
},
|
||||
{
|
||||
"id":2,
|
||||
"photo": ["shirt8_1x", "shirt8_1_1x"],
|
||||
"alt" :"ЗИП МУЖСКОЙ",
|
||||
"name": "ЗИП МУЖСКОЙ",
|
||||
"price": "1500 руб.",
|
||||
"setphoto": ["shirt8_1x","shirt8_1_1x","shirt8_2x","shirt8_1_2x", "shirt8_4x", "shirt8_1_4x"],
|
||||
"size": ["XS/S","M/L","XL/XLL"],
|
||||
"body": ["7934",
|
||||
"Весна-Осень 2023",
|
||||
"Третьяковская галерея",
|
||||
"с застежкой",
|
||||
"черный",
|
||||
"100% Хлопок",
|
||||
"свободный",
|
||||
"надпись",
|
||||
"удлиненная",
|
||||
"90-80-96",
|
||||
"182",
|
||||
"L (50)",
|
||||
"с карманами",
|
||||
"160",
|
||||
"Мужской"]
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"photo": ["shirt1_1x", "shirt1_1_1x"],
|
||||
"alt" :"Фотография футболки белого цвета с цитатой из К/ф Кавказская пленница",
|
||||
"name": "Футболка с принтом Мосфильм",
|
||||
"price": "1500 руб.",
|
||||
"setphoto": ["shirt1_1x","shirt1_1_1x","shirt1_2x","shirt1_1_2x", "shirt1_4x", "shirt1_1_4x"],
|
||||
"size": ["XS/S","M/L","XL/XLL"],
|
||||
"body": ["79776",
|
||||
"Весна-Лето 2021",
|
||||
"Третьяковская галерея",
|
||||
"без застежки",
|
||||
"темно-серый",
|
||||
"100% Хлопок",
|
||||
"свободный",
|
||||
"надписи",
|
||||
"удлиненная",
|
||||
"101-78-96",
|
||||
"189",
|
||||
"L (50)",
|
||||
"без карманов",
|
||||
"160",
|
||||
"Женский"]
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"photo": ["shirt9_1x", "shirt9.1_1x"],
|
||||
"alt" :"ЛАВАНДОВОЕ ХУДИ",
|
||||
"name": "ЛАВАНДОВОЕ ХУДИ",
|
||||
"price": "1500 руб.",
|
||||
"setphoto": ["shirt9_1x","shirt9.1_1x","shirt9_2x","shirt9.1_2x", "shirt9_4x", "shirt9.1_4x"],
|
||||
"size": ["XS/S","M/L","XL/XLL"],
|
||||
"body": ["79276",
|
||||
"Весна-Лето 2021",
|
||||
"Третьяковская галерея",
|
||||
"без застежки",
|
||||
"лавандовы",
|
||||
"100% Хлопок",
|
||||
"свободный",
|
||||
"надписи",
|
||||
"удлиненная",
|
||||
"101-78-96",
|
||||
"184",
|
||||
"L (50)",
|
||||
"с карманами",
|
||||
"160",
|
||||
"Женский"]
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"photo": ["shirt10_1x", "shirt10.1_1x"],
|
||||
"alt" :"ФУТБОЛКА АНИМЕ",
|
||||
"name": "ФУТБОЛКА АНИМА",
|
||||
"price": "1500 руб.",
|
||||
"setphoto": ["shirt10_1x","shirt10.1_1x","shirt10_2x","shirt10.1_2x", "shirt10_4x", "shirt10.1_4x"],
|
||||
"size": ["XS/S","M/L","XL/XLL"],
|
||||
"body": ["79276",
|
||||
"Лето 2024",
|
||||
"Третьяковская галерея",
|
||||
"без застежки",
|
||||
"фистошковый",
|
||||
"100% Хлопок",
|
||||
"свободный",
|
||||
"картина",
|
||||
"удлиненная",
|
||||
"101-78-96",
|
||||
"189",
|
||||
"L (50)",
|
||||
"без карманов",
|
||||
"160",
|
||||
"Мужской"]
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"photo": ["shirt11_1x", "shirt11.1_1x"],
|
||||
"alt" :"ФУТБОЛКА ОВЕРСАЙЗ С ПРИНТОМ ЭРАРТА",
|
||||
"name": "ФУТБОЛКА ОВЕРСАЙЗ С ПРИНТОМ ЭРАРТА",
|
||||
"price": "1500 руб.",
|
||||
"setphoto": ["shirt11_1x","shirt11.1_1x","shirt11_2x","shirt11.1_2x", "shirt11_4x", "shirt11.1_4x"],
|
||||
"size": ["XS/S","M/L","XL/XLL"],
|
||||
"body": ["79276",
|
||||
"Лето 2024",
|
||||
"Третьяковская галерея",
|
||||
"без застежки",
|
||||
"черный",
|
||||
"100% Хлопок",
|
||||
"свободный",
|
||||
"картина",
|
||||
"удлиненная",
|
||||
"101-78-96",
|
||||
"189",
|
||||
"L (50)",
|
||||
"без карманов",
|
||||
"160",
|
||||
"Женский"]
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"photo": ["shirt7_1x", "shirt7_1_1x"],
|
||||
"alt" :"ФУТБОЛКА 'ЧЕРНОЕ МОРЕ'",
|
||||
"name": "ФУТБОЛКА 'ЧЕРНОЕ МОРЕ'",
|
||||
"price": "1500 руб.",
|
||||
"color" : "Белый",
|
||||
"colorid" : 1,
|
||||
"colorcss": ["#606060","#FFFFFF"],
|
||||
"setphoto": ["shirt7_1x","shirt7_1_1x","shirt7_2x","shirt7_1_2x", "shirt7_4x", "shirt7_1_4x"],
|
||||
"size": ["XS/S","M/L","XL/XLL"],
|
||||
"body": ["79653",
|
||||
"Весна-Лето 2023",
|
||||
"Черное море",
|
||||
"без застежки",
|
||||
"светло-серый",
|
||||
"100% Хлопок",
|
||||
"свободный",
|
||||
"картина",
|
||||
"удлиненная",
|
||||
"101-78-96",
|
||||
"178",
|
||||
"M (48)",
|
||||
"без карманов",
|
||||
"160",
|
||||
"Женский"]
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
17
server/routers/r-and-m/index.js
Normal file
17
server/routers/r-and-m/index.js
Normal file
@@ -0,0 +1,17 @@
|
||||
const router = require('express').Router();
|
||||
|
||||
router.get('/landing-data', (request, response) => {
|
||||
response.send(require('./json/landing-data/success.json'));
|
||||
});
|
||||
|
||||
router.post('/search', (req, res) => {
|
||||
const { search } = req.body;
|
||||
|
||||
if (search === 'Morty') {
|
||||
return res.send(require('./json/seach/alive.success.json'));
|
||||
}
|
||||
|
||||
res.send(require('./json/seach/success.json'));
|
||||
})
|
||||
|
||||
module.exports = router;
|
||||
3
server/routers/r-and-m/json/landing-data/error.json
Normal file
3
server/routers/r-and-m/json/landing-data/error.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"error": "not found"
|
||||
}
|
||||
40
server/routers/r-and-m/json/landing-data/success.json
Normal file
40
server/routers/r-and-m/json/landing-data/success.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"id": "0.9212559272707432",
|
||||
"title": "Рик Санчез",
|
||||
"subTitle": "Главный герой",
|
||||
"body": "Он ученый-изобретатель, который путешествует по разным мирам и измерениям, используя свою уникальную машину для путешествий. Рик обладает острым умом и нестандартным мышлением, что позволяет ему решать самые сложные проблемы. Он также известен своим цинизмом и сарказмом, что делает его персонажем с ярким характером.",
|
||||
"image": "rick",
|
||||
"link": "https://en.wikipedia.org/wiki/Rick_Sanchez"
|
||||
},
|
||||
{
|
||||
"id": "0.44732992281434125",
|
||||
"title": "Морти Смит",
|
||||
"subTitle": "Внук Рика",
|
||||
"body": "Обычный подросток, который часто оказывается втянутым в приключения своего дедушки. Морти часто испытывает трудности с принятием решений и не всегда понимает, что происходит вокруг него. Однако, несмотря на свою неопытность, Морти часто оказывается ключевым элементом в решении сложных ситуаций.",
|
||||
"image": "morty",
|
||||
"link": "https://en.wikipedia.org/wiki/morty"
|
||||
},
|
||||
{
|
||||
"id": "0.9858955616085823",
|
||||
"title": "Бет Смит",
|
||||
"subTitle": "Мать Морти",
|
||||
"body": "Бет Смит также является мамой Морти. Она врач и мать-одиночка, которая старается поддерживать свою семью. Бет часто оказывается в конфликте с Риком из-за его безответственного поведения и постоянных приключений. Однако, несмотря на все трудности, Бет всегда готова прийти на помощь своей семье.",
|
||||
"image": "beth",
|
||||
"link": "https://en.wikipedia.org/wiki/beth"
|
||||
},
|
||||
{
|
||||
"id": "0.1590784370756242",
|
||||
"title": "Джерри Смит",
|
||||
"subTitle": "Отец Морти",
|
||||
"body": "Джерри Смит - муж Бет. Он обычный человек, который старается справиться с жизнью в семье, полной необычных персонажей. Джерри часто оказывается в тени Рика и Морти, но он всегда готов поддержать свою семью в трудные моменты.",
|
||||
"image": "jerry",
|
||||
"link": "https://en.wikipedia.org/wiki/beth"
|
||||
},
|
||||
{
|
||||
"id": "0.29021795027285324",
|
||||
"body": "Семья Смитов - это только часть персонажей, представленных в сериале \"Rick and Morty\". В сериале также присутствуют множество других интересных и запоминающихся персонажей, каждый из которых имеет свою уникальную историю и характер. На этой странице вы сможете узнать больше о каждом персонаже, его истории и роли в сериале. Мы также предлагаем вам возможность ознакомиться с интересными фактами о создании сериала и его персонажах. Присоединяйтесь к нам и погрузитесь в увлекательный мир \"Rick and Morty\"!"
|
||||
}
|
||||
]
|
||||
}
|
||||
24
server/routers/r-and-m/json/seach/alive.success.json
Normal file
24
server/routers/r-and-m/json/seach/alive.success.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"id": 14,
|
||||
"name": "Morty",
|
||||
"status": "alive",
|
||||
"species": "Alien",
|
||||
"type": "",
|
||||
"gender": "Male",
|
||||
"origin": {
|
||||
"name": "unknown",
|
||||
"url": ""
|
||||
},
|
||||
"location": {
|
||||
"name": "Citadel of Ricks",
|
||||
"url": "https://rickandmortyapi.com/api/location/3"
|
||||
},
|
||||
"image": "https://rickandmortyapi.com/api/character/avatar/14.jpeg",
|
||||
"episode": ["https://rickandmortyapi.com/api/episode/10"],
|
||||
"url": "https://rickandmortyapi.com/api/character/14",
|
||||
"created": "2017-11-04T20:51:31.373Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
24
server/routers/r-and-m/json/seach/success.json
Normal file
24
server/routers/r-and-m/json/seach/success.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"id": 14,
|
||||
"name": "Alien Morty",
|
||||
"status": "unknown",
|
||||
"species": "Alien",
|
||||
"type": "",
|
||||
"gender": "Male",
|
||||
"origin": {
|
||||
"name": "unknown",
|
||||
"url": ""
|
||||
},
|
||||
"location": {
|
||||
"name": "Citadel of Ricks",
|
||||
"url": "https://rickandmortyapi.com/api/location/3"
|
||||
},
|
||||
"image": "https://rickandmortyapi.com/api/character/avatar/14.jpeg",
|
||||
"episode": ["https://rickandmortyapi.com/api/episode/10"],
|
||||
"url": "https://rickandmortyapi.com/api/character/14",
|
||||
"created": "2017-11-04T20:51:31.373Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
136
server/routers/webstar-project/index.js
Normal file
136
server/routers/webstar-project/index.js
Normal file
@@ -0,0 +1,136 @@
|
||||
const router = require('express').Router();
|
||||
const authMiddleware = require('./middleware/auth-middleware');
|
||||
|
||||
router.get('/cards-data', (request, response) => {
|
||||
response.send(require('./json/cards-data/success.json'))
|
||||
})
|
||||
|
||||
router.get('/messages', (request, response) => {
|
||||
response.send(require('./json/messages/success.json'))
|
||||
})
|
||||
|
||||
router.get('/user', authMiddleware, (request, response) => {
|
||||
const email = request.userEmail;
|
||||
|
||||
try {
|
||||
const usersData = require('./json/users-data/success.json');
|
||||
const userData = usersData.data.find(user => user.email === email);
|
||||
|
||||
if (userData) {
|
||||
return response.json(userData.favourites);
|
||||
}
|
||||
response.status(404).send('User not found');
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error reading file:', error);
|
||||
response.status(500).send('Internal server error');
|
||||
}
|
||||
})
|
||||
|
||||
router.get('/cards-data/:id', (request, response) => {
|
||||
const cardId = request.params.id;
|
||||
|
||||
try {
|
||||
const cardsData = require('./json/cards-data/success.json');
|
||||
const cardData = cardsData.data.find(card => card.id === cardId);
|
||||
|
||||
if (cardData) {
|
||||
return response.json(cardData);
|
||||
}
|
||||
response.status(404).send('Card not found');
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error reading file:', error);
|
||||
response.status(500).send('Internal server error');
|
||||
}
|
||||
})
|
||||
|
||||
router.get('/messages/:id', (request, response) => {
|
||||
const cardId = request.params.id;
|
||||
|
||||
try {
|
||||
const cardsData = require('./json/messages/success.json');
|
||||
const cardData = cardsData.data.find(card => card.id === cardId);
|
||||
|
||||
if (cardData) {
|
||||
return response.json(cardData);
|
||||
}
|
||||
response.status(404).send('Card not found');
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error reading file:', error);
|
||||
response.status(500).send('Internal server error');
|
||||
}
|
||||
})
|
||||
|
||||
router.post('/login', (request, response) => {
|
||||
const { email, password } = request.body.loginData;
|
||||
|
||||
try {
|
||||
const users = require('./json/users-data/success.json');
|
||||
const user = users.data.find(user => user.email === email && user.password === password);
|
||||
|
||||
if (!user) {
|
||||
return response.status(401).send('Invalid credentials');
|
||||
}
|
||||
|
||||
const responseObject = {
|
||||
email: user.email,
|
||||
}
|
||||
|
||||
if (user.cardId){
|
||||
responseObject.cardId = user.cardId || "";
|
||||
}
|
||||
return response.json(responseObject);
|
||||
} catch (error) {
|
||||
console.error('Error reading file:', error);
|
||||
response.status(500).send('Internal server error');
|
||||
}
|
||||
})
|
||||
|
||||
router.post('/register', async (request, response) => {
|
||||
const { _name, email, password, confirmPassword } = request.body.registerData;
|
||||
|
||||
try {
|
||||
if (password !== confirmPassword) {
|
||||
return response.status(400).send('Passwords do not match');
|
||||
}
|
||||
const users = require('./json/users-data/success.json');
|
||||
|
||||
const existingUser = users.data.find(user => user.email === email);
|
||||
|
||||
if (existingUser) {
|
||||
return response.status(400).send('User with this email already exists');
|
||||
}
|
||||
|
||||
return response.json({ email: email});
|
||||
} catch (error) {
|
||||
console.error('Error registering user:', error);
|
||||
response.status(500).send('Internal server error');
|
||||
}
|
||||
});
|
||||
|
||||
router.post('/favourite', async (request, response) => {
|
||||
const { cardId, email } = request.body;
|
||||
|
||||
try {
|
||||
const users = require('./json/users-data/success.json');
|
||||
const user = users.data.find(user => user.email === email);
|
||||
|
||||
if (!user) {
|
||||
return response.status(404).send('User not found');
|
||||
}
|
||||
|
||||
const index = user.favourites.indexOf(cardId);
|
||||
if (index !== -1) {
|
||||
return response.status(200).send('Card removed from favourites successfully');
|
||||
}
|
||||
|
||||
response.status(200).send('Card added to favourites successfully');
|
||||
} catch (error) {
|
||||
console.error('Error adding card to favourites:', error);
|
||||
response.status(500).send('Internal server error');
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
172
server/routers/webstar-project/json/cards-data/success.json
Normal file
172
server/routers/webstar-project/json/cards-data/success.json
Normal file
@@ -0,0 +1,172 @@
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"id": "1",
|
||||
"ownerId": "user1@gmail.com",
|
||||
"sliderImages": ["site1", "site2", "site3"],
|
||||
"title": "Верстка сайтов любой сложности. Мобильная разработка",
|
||||
"tags": ["Сайты", "Под ключ", "Десктоп"],
|
||||
"profileData": {
|
||||
"name": "Yuji Itadori",
|
||||
"geolocation": "г. Казань",
|
||||
"description": "Lorem, ipsum dolor sit amet consectetur adipisicing elit. Expedita nemo cumque, magni doloremque aspernatur illo nisi magnam! Perspiciatis, aspernatur excepturi dolores autem, ut sequi dolore vitae doloremque ratione expedita velit molestias quidem hic quod culpa corrupti vel ad.",
|
||||
"profilePicture": "site1",
|
||||
"backgroundImage": "backgroundImage1"
|
||||
},
|
||||
"articles": [
|
||||
{
|
||||
"id": "1",
|
||||
"label": "Верстка статичного сайта",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site1"
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"label": "Разработка простого мобильного приложения",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"ownerId": "admin@admin.ru",
|
||||
"sliderImages": ["site2", "site1", "site3"],
|
||||
"title": "Дизайн сайтов. Разработка сайтов под ключ",
|
||||
"tags": ["Сайты", "Под ключ", "Десктоп"],
|
||||
"profileData": {
|
||||
"name": "Admin",
|
||||
"geolocation": "г. Казань",
|
||||
"description": "Lorem, ipsum dolor sit amet consectetur adipisicing elit. Expedita nemo cumque, magni doloremque aspernatur illo nisi magnam! Perspiciatis, aspernatur excepturi dolores autem, ut sequi dolore vitae doloremque ratione expedita velit molestias quidem hic quod culpa corrupti vel ad.",
|
||||
"profilePicture": "site2",
|
||||
"backgroundImage": "backgroundImage1"
|
||||
},
|
||||
"articles": [
|
||||
{
|
||||
"id": "1",
|
||||
"label": "Верстка статичного сайта",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site1"
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"label": "Разработка простого мобильного приложения",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "3",
|
||||
"ownerId": "user2@gmail.com",
|
||||
"sliderImages": ["site3", "site1", "site3"],
|
||||
"title": "FullStack разработка приложений на React",
|
||||
"tags": ["Сайты", "Под ключ", "Десктоп"],
|
||||
"profileData": {
|
||||
"name": "Secret Guest",
|
||||
"geolocation": "г. Казань",
|
||||
"description": "Lorem, ipsum dolor sit amet consectetur adipisicing elit. Expedita nemo cumque, magni doloremque aspernatur illo nisi magnam! Perspiciatis, aspernatur excepturi dolores autem, ut sequi dolore vitae doloremque ratione expedita velit molestias quidem hic quod culpa corrupti vel ad.",
|
||||
"profilePicture": "site3",
|
||||
"backgroundImage": "backgroundImage1"
|
||||
},
|
||||
"articles": [
|
||||
{
|
||||
"id": "1",
|
||||
"label": "Верстка статичного сайта",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site1"
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"label": "Разработка простого мобильного приложения",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "4",
|
||||
"ownerId": "super@star.ru",
|
||||
"sliderImages": ["site1", "site1", "site3"],
|
||||
"title": "Верстка сайтов любой сложности. Мобильная разработка",
|
||||
"tags": ["Сайты", "Под ключ", "Десктоп"],
|
||||
"profileData": {
|
||||
"name": "Hatsune Miku",
|
||||
"geolocation": "г. Казань",
|
||||
"description": "Lorem, ipsum dolor sit amet consectetur adipisicing elit. Expedita nemo cumque, magni doloremque aspernatur illo nisi magnam! Perspiciatis, aspernatur excepturi dolores autem, ut sequi dolore vitae doloremque ratione expedita velit molestias quidem hic quod culpa corrupti vel ad.",
|
||||
"profilePicture": "site3",
|
||||
"backgroundImage": "backgroundImage1"
|
||||
},
|
||||
"articles": [
|
||||
{
|
||||
"id": "1",
|
||||
"label": "Верстка статичного сайта",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site1"
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"label": "Разработка простого мобильного приложения",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "5",
|
||||
"ownerId": "sb@sb.ru",
|
||||
"sliderImages": ["site2", "site1", "site3"],
|
||||
"title": "Дизайн сайтов. Разработка сайтов под ключ",
|
||||
"tags": ["Дизайн", "Под ключ"],
|
||||
"profileData": {
|
||||
"name": "СберТян",
|
||||
"geolocation": "г. Казань",
|
||||
"description": "Lorem, ipsum dolor sit amet consectetur adipisicing elit. Expedita nemo cumque, magni doloremque aspernatur illo nisi magnam! Perspiciatis, aspernatur excepturi dolores autem, ut sequi dolore vitae doloremque ratione expedita velit molestias quidem hic quod culpa corrupti vel ad.",
|
||||
"profilePicture": "site3",
|
||||
"backgroundImage": "backgroundImage1"
|
||||
},
|
||||
"articles": [
|
||||
{
|
||||
"id": "1",
|
||||
"label": "Верстка статичного сайта",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site1"
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"label": "Разработка простого мобильного приложения",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "6",
|
||||
"ownerId": "tin@tin.ru",
|
||||
"sliderImages": ["site3", "site1", "site3"],
|
||||
"title": "FullStack разработка приложений на React",
|
||||
"tags": ["Сайты", "Под ключ", "Мобильные устройства"],
|
||||
"profileData": {
|
||||
"name": "Помощник Олег",
|
||||
"geolocation": "г. Казань",
|
||||
"description": "Lorem, ipsum dolor sit amet consectetur adipisicing elit. Expedita nemo cumque, magni doloremque aspernatur illo nisi magnam! Perspiciatis, aspernatur excepturi dolores autem, ut sequi dolore vitae doloremque ratione expedita velit molestias quidem hic quod culpa corrupti vel ad.",
|
||||
"profilePicture": "site3",
|
||||
"backgroundImage": "backgroundImage1"
|
||||
},
|
||||
"articles": [
|
||||
{
|
||||
"id": "1",
|
||||
"label": "Верстка статичного сайта",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site1"
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"label": "Разработка простого мобильного приложения",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site2"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
149
server/routers/webstar-project/json/messages/success.json
Normal file
149
server/routers/webstar-project/json/messages/success.json
Normal file
@@ -0,0 +1,149 @@
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"id": "1",
|
||||
"ownerId": "user1@gmail.ru",
|
||||
"onModerating": true,
|
||||
"sliderImages": ["site1", "site2", "site3"],
|
||||
"title": "Верстка сайтов любой сложности. Мобильная разработка",
|
||||
"tags": ["Сайты", "Под ключ", "Десктоп"],
|
||||
"profileData": {
|
||||
"name": "Yuji Itadori",
|
||||
"geolocation": "г. Казань",
|
||||
"description": "Lorem, ipsum dolor sit amet consectetur adipisicing elit. Expedita nemo cumque, magni doloremque aspernatur illo nisi magnam! Perspiciatis, aspernatur excepturi dolores autem, ut sequi dolore vitae doloremque ratione expedita velit molestias quidem hic quod culpa corrupti vel ad.",
|
||||
"profilePicture": "site2",
|
||||
"backgroundImage": "backgroundImage1"
|
||||
},
|
||||
"articles": [
|
||||
{
|
||||
"id": "1",
|
||||
"label": "Верстка статичного сайта",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site1"
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"label": "Разработка простого мобильного приложения",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"ownerId": "admin@admin.ru",
|
||||
"onModerating": true,
|
||||
"sliderImages": ["site2", "site1", "site3"],
|
||||
"title": "Дизайн сайтов. Разработка сайтов под ключ",
|
||||
"tags": ["Сайты", "Под ключ", "Десктоп"],
|
||||
"profileData": {
|
||||
"name": "Admin",
|
||||
"geolocation": "г. Казань",
|
||||
"description": "Lorem, ipsum dolor sit amet consectetur adipisicing elit. Expedita nemo cumque, magni doloremque aspernatur illo nisi magnam! Perspiciatis, aspernatur excepturi dolores autem, ut sequi dolore vitae doloremque ratione expedita velit molestias quidem hic quod culpa corrupti vel ad.",
|
||||
"profilePicture": "profilePicture1",
|
||||
"backgroundImage": "backgroundImage1"
|
||||
},
|
||||
"articles": [
|
||||
{
|
||||
"id": "1",
|
||||
"label": "Верстка статичного сайта",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site1"
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"label": "Разработка простого мобильного приложения",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "3",
|
||||
"ownerId": "user2@gmail.com",
|
||||
"onModerating": true,
|
||||
"sliderImages": ["site3", "site1", "site3"],
|
||||
"title": "FullStack разработка приложений на React",
|
||||
"tags": ["Сайты", "Под ключ", "Десктоп"],
|
||||
"profileData": {
|
||||
"name": "Secret Guest",
|
||||
"geolocation": "г. Казань",
|
||||
"description": "Lorem, ipsum dolor sit amet consectetur adipisicing elit. Expedita nemo cumque, magni doloremque aspernatur illo nisi magnam! Perspiciatis, aspernatur excepturi dolores autem, ut sequi dolore vitae doloremque ratione expedita velit molestias quidem hic quod culpa corrupti vel ad.",
|
||||
"profilePicture": "profilePicture1",
|
||||
"backgroundImage": "backgroundImage1"
|
||||
},
|
||||
"articles": [
|
||||
{
|
||||
"id": "1",
|
||||
"label": "Верстка статичного сайта",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site1"
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"label": "Разработка простого мобильного приложения",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "4",
|
||||
"ownerId": "super@star.ru",
|
||||
"onModerating": true,
|
||||
"sliderImages": ["site1", "site1", "site3"],
|
||||
"title": "Верстка сайтов любой сложности. Мобильная разработка",
|
||||
"tags": ["Сайты", "Под ключ", "Десктоп"],
|
||||
"profileData": {
|
||||
"name": "Hatsune Miku",
|
||||
"geolocation": "г. Казань",
|
||||
"description": "Lorem, ipsum dolor sit amet consectetur adipisicing elit. Expedita nemo cumque, magni doloremque aspernatur illo nisi magnam! Perspiciatis, aspernatur excepturi dolores autem, ut sequi dolore vitae doloremque ratione expedita velit molestias quidem hic quod culpa corrupti vel ad.",
|
||||
"profilePicture": "profilePicture1",
|
||||
"backgroundImage": "backgroundImage1"
|
||||
},
|
||||
"articles": [
|
||||
{
|
||||
"id": "1",
|
||||
"label": "Верстка статичного сайта",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site1"
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"label": "Разработка простого мобильного приложения",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "5",
|
||||
"ownerId": "sb@sb.ru",
|
||||
"onModerating": false,
|
||||
"sliderImages": ["site2", "site1", "site3"],
|
||||
"title": "Дизайн сайтов. Разработка сайтов под ключ",
|
||||
"tags": ["Дизайн", "Под ключ"],
|
||||
"profileData": {
|
||||
"name": "СберТян",
|
||||
"geolocation": "г. Казань",
|
||||
"description": "Lorem, ipsum dolor sit amet consectetur adipisicing elit. Expedita nemo cumque, magni doloremque aspernatur illo nisi magnam! Perspiciatis, aspernatur excepturi dolores autem, ut sequi dolore vitae doloremque ratione expedita velit molestias quidem hic quod culpa corrupti vel ad.",
|
||||
"profilePicture": "profilePicture1",
|
||||
"backgroundImage": "backgroundImage1"
|
||||
},
|
||||
"articles": [
|
||||
{
|
||||
"id": "1",
|
||||
"label": "Верстка статичного сайта",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site1"
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"label": "Разработка простого мобильного приложения",
|
||||
"text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt",
|
||||
"imageUrl": "site2"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
50
server/routers/webstar-project/json/users-data/success.json
Normal file
50
server/routers/webstar-project/json/users-data/success.json
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"name": "Yuji Itadori",
|
||||
"email": "user1@gmail.com",
|
||||
"password": "12345",
|
||||
"cardId": "1",
|
||||
"favourites": [
|
||||
"1",
|
||||
"2",
|
||||
"6"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Admin",
|
||||
"email": "admin@admin.ru",
|
||||
"password": "*****",
|
||||
"cardId": "2",
|
||||
"favourites": []
|
||||
},
|
||||
{
|
||||
"name": "Secret Guest",
|
||||
"email": "user2@gmail.com",
|
||||
"password": "qwer",
|
||||
"cardId": "3",
|
||||
"favourites": []
|
||||
},
|
||||
{
|
||||
"name": "Hatsune Miku",
|
||||
"email": "super@star.ru",
|
||||
"password": "12345",
|
||||
"cardId": "4",
|
||||
"favourites": []
|
||||
},
|
||||
{
|
||||
"name": "СберТян",
|
||||
"email": "sb@sb.ru",
|
||||
"password": "12345",
|
||||
"cardId": "5",
|
||||
"favourites": []
|
||||
},
|
||||
{
|
||||
"name": "Помощник Олег",
|
||||
"email": "tin@tin.ru",
|
||||
"password": "12345",
|
||||
"cardId": "6",
|
||||
"favourites": []
|
||||
}
|
||||
]
|
||||
}
|
||||
14
server/routers/webstar-project/middleware/auth-middleware.js
Normal file
14
server/routers/webstar-project/middleware/auth-middleware.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const authMiddleware = (req, res, next) => {
|
||||
const email = (req.headers.authorization || "").replace("Bearer ", "");
|
||||
|
||||
if (email) {
|
||||
req.userEmail = email;
|
||||
next();
|
||||
} else {
|
||||
return res.status(403).json({
|
||||
message: "Access Denied",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = authMiddleware
|
||||
Reference in New Issue
Block a user