-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andrey
authored and
Andrey
committed
Nov 10, 2022
0 parents
commit 973a3ef
Showing
34 changed files
with
10,478 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
env: { | ||
commonjs: true, | ||
es2021: true, | ||
node: true, | ||
jest: true, | ||
}, | ||
extends: ["standard", "prettier"], | ||
parserOptions: { | ||
ecmaVersion: 12, | ||
}, | ||
rules: {}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/ | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"printWidth": 150, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": false, | ||
"trailingComma": "es5", | ||
"bracketSpacing": true, | ||
"jsxBracketSameLine": false, | ||
"arrowParens": "avoid", | ||
"proseWrap": "always" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM node | ||
WORKDIR /app | ||
COPY . . | ||
RUN npm install | ||
EXPOSE 3000 | ||
CMD ["node", "server"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const express = require("express"); | ||
const logger = require("morgan"); | ||
const cors = require("cors"); | ||
require("dotenv").config(); | ||
|
||
const newsRouter = require("./routes/news"); | ||
const friendsRouter = require("./routes/friends"); | ||
|
||
const app = express(); | ||
|
||
const formatsLogger = app.get("env") === "development" ? "dev" : "short"; | ||
|
||
app.use(logger(formatsLogger)); | ||
app.use(cors()); | ||
app.use(express.json()); | ||
app.use(express.static("public")); | ||
|
||
app.use("/news", newsRouter); | ||
app.use("/friends", friendsRouter); | ||
|
||
app.use((req, res) => { | ||
res.status(404).json({ message: "Not found" }); | ||
}); | ||
|
||
app.use((err, req, res, next) => { | ||
const { status = 500, message = "Server error" } = err; | ||
res.status(status).json({ message }); | ||
}); | ||
|
||
module.exports = app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const { Friends } = require("../../models/friends"); | ||
|
||
const getAll = async (req, res) => { | ||
const friends = await Friends.find({}); | ||
|
||
res.json({ | ||
message: "success", | ||
data: { result: friends }, | ||
}); | ||
}; | ||
|
||
module.exports = getAll; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const getAll = require("./getAll"); | ||
|
||
module.exports = { | ||
getAll, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const news = require("./news"); | ||
const friends = require("./friends"); | ||
|
||
module.exports = { | ||
news, | ||
friends, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const { News } = require("../../models/news"); | ||
|
||
const getAll = async (req, res) => { | ||
const news = await News.find({}); | ||
|
||
res.json({ | ||
message: "success", | ||
data: { result: news }, | ||
}); | ||
}; | ||
|
||
module.exports = getAll; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const getAll = require("./getAll"); | ||
|
||
module.exports = { | ||
getAll, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
DB_HOST= | ||
SECRET_KEY= | ||
CLOUD_NAME= | ||
CLOUD_KEY= | ||
CLOUD_SECRET= | ||
SENDGRID_API_KEY= | ||
SENDER_EMAIL_ADRESS= | ||
BASE_URL= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const ctrlWrapper = (ctrl) => { | ||
const func = async (req, res, next) => { | ||
try { | ||
await ctrl(req, res, next); | ||
} catch (error) { | ||
next(error); | ||
} | ||
}; | ||
return func; | ||
}; | ||
|
||
module.exports = ctrlWrapper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const ctrlWrapper = require("./ctrlWrapper"); | ||
const requestError = require("./requestError"); | ||
|
||
module.exports = { | ||
ctrlWrapper, | ||
requestError, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const messages = { | ||
400: 'Bad requsest', | ||
401: 'Unauthorized', | ||
403: 'Forbidden', | ||
404: 'Not found', | ||
}; | ||
|
||
const RequestError = (status, message = messages[status]) => { | ||
const error = new Error(message); | ||
error.status = status; | ||
|
||
return error; | ||
}; | ||
|
||
module.exports = RequestError; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const { Schema, model } = require("mongoose"); | ||
|
||
const newsSchema = Schema( | ||
{ | ||
name: { | ||
type: String, | ||
required: true, | ||
unique: true, | ||
}, | ||
time: { | ||
type: String, | ||
}, | ||
adress: { | ||
type: String, | ||
}, | ||
phone: { | ||
type: String, | ||
}, | ||
email: { | ||
type: String, | ||
}, | ||
logo: { | ||
type: String, | ||
}, | ||
link: { | ||
type: String, | ||
}, | ||
}, | ||
{ versionKey: false } | ||
); | ||
|
||
const Friends = model("friends", newsSchema); | ||
|
||
module.exports = { | ||
Friends, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
[ | ||
{ | ||
"name": "Барбос", | ||
"time": { | ||
"MN": "8:00- 20:00", | ||
"TU": "8:00- 20:00", | ||
"WE": "8:00- 20:00", | ||
"TH": "8:00- 20:00", | ||
"FR": "8:00- 20:00", | ||
"SA": "8:00- 20:00", | ||
"SU": "8:00- 20:00" | ||
}, | ||
"adress": "Grigorenka Street, 25 ", | ||
"phone": "+3110 44 290-03-29", | ||
"email": "barbos@gmail.com", | ||
"logo": "https://s.0312.ua/section/newsInText/upload/images/news/intext/000/050/1113/barbos-logo_5c0711b136ea2f.jpg", | ||
"link": "https://www.facebook.com/NGO.Barbos" | ||
}, | ||
{ | ||
"name": "Whiskas", | ||
"time": { | ||
"MN": "8:00- 19:00", | ||
"TU": "8:00- 19:00", | ||
"WE": "8:00- 19:00", | ||
"TH": "8:00- 19:00", | ||
"FR": "8:00- 19:00", | ||
"SA": "8:00- 19:00", | ||
"SU": "8:00- 19:00" | ||
}, | ||
"adress": "------------", | ||
"phone": "0-1100-500-155", | ||
"email": "whiskas@gmail.com", | ||
"logo": "https://www.whiskas.ua/Content/img/public/logo.png", | ||
"link": "https://www.whiskas.ua/" | ||
}, | ||
{ | ||
"name": "ЛКП 'ЛЕВ' ", | ||
"time": { | ||
"MN": "8:00- 19:00", | ||
"TU": "8:00- 19:00", | ||
"WE": "8:00- 19:00", | ||
"TH": "8:00- 19:00", | ||
"FR": "8:00- 19:00", | ||
"SA": "8:00- 19:00", | ||
"SU": "8:00- 19:00" | ||
}, | ||
"adress": "Promyslova Street, 56 ", | ||
"phone": "(068) 535-45-45", | ||
"email": "lkplev@gmail.com", | ||
"logo": "https://lkplev.com/images/logo.png", | ||
"link": "https://lkplev.com/" | ||
}, | ||
{ | ||
"name": "Happy paw", | ||
"time": { | ||
"MN": "09:00- 19:00", | ||
"TU": "09:00- 19:00", | ||
"WE": "09:00- 19:00", | ||
"TH": "09:00- 19:00", | ||
"FR": "09:00- 19:00", | ||
"SA": "09:00- 19:00", | ||
"SU": "09:00- 19:00" | ||
}, | ||
"adress": "Chota Rystaveli Street, 44", | ||
"phone": "+380 44 290-03-29", | ||
"email": "hello@happypaw.ua", | ||
"logo": "", | ||
"link": "https://happypaw.ua/ua/" | ||
}, | ||
{ | ||
"name": "PetHelp", | ||
"time": {}, | ||
"adress": "------------", | ||
"phone": "------------", | ||
"email": "pithelp.ukr@gmail.com", | ||
"logo": "https://pethelp.com.ua/images/logo3.png", | ||
"link": "https://pethelp.com.ua/" | ||
}, | ||
{ | ||
"name": "Сіріус", | ||
"time": { | ||
"MN": "11:00- 16:00", | ||
"TU": "11:00- 16:00", | ||
"WE": "11:00- 16:00", | ||
"TH": "11:00- 16:00", | ||
"FR": "11:00- 16:00", | ||
"SA": "11:00- 16:00", | ||
"SU": "11:00- 16:00" | ||
}, | ||
"adress": "Fedorivka, Kyiv Oblast", | ||
"phone": "+38 093 193 40 69", | ||
"email": "dogcat.sirius@gmail.com", | ||
"logo": "https://dogcat.com.ua/images/logo-horizontal.svg", | ||
"link": "https://dogcat.com.ua/" | ||
}, | ||
{ | ||
"name": "PURINA", | ||
"time": {}, | ||
"adress": "------------", | ||
"phone": "1-800-778-7462", | ||
"email": "info@ua.nestle.com", | ||
"logo": "https://www.whiskas.ua/Content/img/public/logo.png", | ||
"link": "https://www.purina.ua/" | ||
}, | ||
{ | ||
"name": "Josera", | ||
"time": { | ||
"MN": "09:00- 17:00", | ||
"TU": "09:00- 17:00", | ||
"WE": "09:00- 17:00", | ||
"TH": "09:00- 17:00", | ||
"FR": "09:00- 17:00", | ||
"SA": "09:00- 17:00", | ||
"SU": "09:00- 17:00" | ||
}, | ||
"adress": "Sholom-Aleikhema St, 11", | ||
"phone": "0 800 409 060", | ||
"email": "info@josera.ua", | ||
"logo": "https://josera.ua/static/frontend/Magecom/josera/uk_UA/images/logo.svg", | ||
"link": "https://josera.ua/" | ||
}, | ||
{ | ||
"name": "LICO", | ||
"time": { | ||
"MN": "09:00- 20:00", | ||
"TU": "09:00- 20:00", | ||
"WE": "09:00- 20:00", | ||
"TH": "09:00- 20:00", | ||
"FR": "09:00- 20:00", | ||
"SA": "09:00- 20:00", | ||
"SU": "09:00- 20:00" | ||
}, | ||
"adress": "Dryhetiv Street, 77", | ||
"phone": "+38 097 509 8005", | ||
"email": "lico@gmail.com", | ||
"logo": "https://lico.vet/wp-content/uploads/2020/11/licoveterinary-e1605477412808.png", | ||
"link": "https://lico.vet/" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const { Schema, model } = require("mongoose"); | ||
|
||
const newsSchema = Schema( | ||
{ | ||
title: { | ||
type: String, | ||
required: [true, "Set name for contact"], | ||
unique: true, | ||
}, | ||
description: { | ||
type: String, | ||
}, | ||
date: { | ||
type: String, | ||
default: "12/11/2022", | ||
}, | ||
link: { | ||
type: String, | ||
}, | ||
}, | ||
{ versionKey: false } | ||
); | ||
|
||
const News = model("news", newsSchema); | ||
|
||
module.exports = { | ||
News, | ||
}; |
Oops, something went wrong.