Skip to content

Commit 638813f

Browse files
authored
Merge pull request cyclic-software#1 from niallam22/animation
Animation
2 parents 1af7496 + 774f6bd commit 638813f

File tree

120 files changed

+52774
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+52774
-4
lines changed

api/controllers/auth.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const salt = bcrypt.genSaltSync(10);
5757
exports.profileAuth = function(req, res, next){ //should be async
5858
const {token} = req.cookies;
5959
if(!token){
60-
res.json({msg: 'no user'})
60+
res.json({})
6161
}else {
6262
try {
6363
jwt.verify(token, process.env.jwtSecret, {}, (err,info) => {

api/controllers/home.js

+33-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const Post = require('../models/Post')
33
const fs = require('fs');
44
const { jwt } = require('../config/jwt');
55
require('dotenv').config({path: './config/.env'})
6+
const nodemailer = require('nodemailer');
67

78
exports.createPost = async (req, res, next) => {
89
const {originalname,path} = req.file;
@@ -71,4 +72,35 @@ exports.getPost = async (req, res, next) => {
7172
const {id} = req.params;
7273
const postDoc = await Post.findById(id).populate('author', ['username']);
7374
res.json(postDoc);
74-
}
75+
}
76+
77+
exports.submitContactForm = async(req, res, next) => {
78+
const { name, email, message } = req.body;
79+
80+
console.log('submitContactForm home controller user: ',process.env.user)
81+
const transporter = nodemailer.createTransport({
82+
host: 'smtp-relay.sendinblue.com',
83+
port: 587,
84+
auth: {
85+
user: process.env.user,
86+
pass: process.env.pass
87+
}
88+
});
89+
90+
const mailOptions = {
91+
92+
93+
subject: 'New form submission',
94+
text: `Name: ${name}\nEmail: ${email}\nMessage: ${message}`
95+
};
96+
97+
try {
98+
await transporter.sendMail(mailOptions);
99+
console.log('Email sent');
100+
res.status(200).send('Email sent successfully');
101+
} catch (error) {
102+
console.error(error);
103+
res.status(500).send('Error sending email');
104+
}
105+
};
106+

api/package-lock.json

+14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"mongoose": "^7.0.2",
2121
"morgan": "^1.10.0",
2222
"multer": "^1.4.5-lts.1",
23+
"nodemailer": "^6.9.1",
2324
"nodemon": "^2.0.22"
2425
}
2526
}

api/routes/main.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ router.get('/profile',authController.profileAuth)
1212
router.post('/logout', authController.logout)
1313

1414

15-
15+
router.post('/submitContactForm', homeController.submitContactForm)
1616
router.post('/post',uploadMiddleware.single('file'), homeController.createPost)
1717
router.put('/post',uploadMiddleware.single('file'), homeController.updatePost)
1818
router.get('/post',homeController.getPosts)
1919
router.get('/post/:id',homeController.getPost)
2020

2121

22+
23+
24+
2225
module.exports = router

client

-1
This file was deleted.

client/.DS_Store

6 KB
Binary file not shown.

client/README.md

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Getting Started with Create React App
2+
3+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4+
5+
## Available Scripts
6+
7+
In the project directory, you can run:
8+
9+
### `npm start`
10+
11+
Runs the app in the development mode.\
12+
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
13+
14+
The page will reload when you make changes.\
15+
You may also see any lint errors in the console.
16+
17+
### `npm test`
18+
19+
Launches the test runner in the interactive watch mode.\
20+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21+
22+
### `npm run build`
23+
24+
Builds the app for production to the `build` folder.\
25+
It correctly bundles React in production mode and optimizes the build for the best performance.
26+
27+
The build is minified and the filenames include the hashes.\
28+
Your app is ready to be deployed!
29+
30+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31+
32+
### `npm run eject`
33+
34+
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
35+
36+
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37+
38+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
39+
40+
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
41+
42+
## Learn More
43+
44+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45+
46+
To learn React, check out the [React documentation](https://reactjs.org/).
47+
48+
### Code Splitting
49+
50+
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51+
52+
### Analyzing the Bundle Size
53+
54+
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55+
56+
### Making a Progressive Web App
57+
58+
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59+
60+
### Advanced Configuration
61+
62+
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63+
64+
### Deployment
65+
66+
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67+
68+
### `npm run build` fails to minify
69+
70+
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

client/babel-plugin-macros.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
'fontawesome-svg-core': {
3+
'license': 'free'
4+
}
5+
}

client/babel.config.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = function (api) {
2+
api.cache(true);
3+
4+
return {
5+
presets: [
6+
"@babel/preset-env",
7+
"@babel/preset-react"
8+
],
9+
plugins: [
10+
"macros"
11+
]
12+
}
13+
}
14+
15+
16+
17+

0 commit comments

Comments
 (0)