Skip to content

Commit

Permalink
Merge pull request cyclic-software#1 from niallam22/animation
Browse files Browse the repository at this point in the history
Animation
  • Loading branch information
niallam22 authored Apr 12, 2023
2 parents 1af7496 + 774f6bd commit 638813f
Show file tree
Hide file tree
Showing 120 changed files with 52,774 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api/controllers/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const salt = bcrypt.genSaltSync(10);
exports.profileAuth = function(req, res, next){ //should be async
const {token} = req.cookies;
if(!token){
res.json({msg: 'no user'})
res.json({})
}else {
try {
jwt.verify(token, process.env.jwtSecret, {}, (err,info) => {
Expand Down
34 changes: 33 additions & 1 deletion api/controllers/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const Post = require('../models/Post')
const fs = require('fs');
const { jwt } = require('../config/jwt');
require('dotenv').config({path: './config/.env'})
const nodemailer = require('nodemailer');

exports.createPost = async (req, res, next) => {
const {originalname,path} = req.file;
Expand Down Expand Up @@ -71,4 +72,35 @@ exports.getPost = async (req, res, next) => {
const {id} = req.params;
const postDoc = await Post.findById(id).populate('author', ['username']);
res.json(postDoc);
}
}

exports.submitContactForm = async(req, res, next) => {
const { name, email, message } = req.body;

console.log('submitContactForm home controller user: ',process.env.user)
const transporter = nodemailer.createTransport({
host: 'smtp-relay.sendinblue.com',
port: 587,
auth: {
user: process.env.user,
pass: process.env.pass
}
});

const mailOptions = {
from: '[email protected]',
to: '[email protected]',
subject: 'New form submission',
text: `Name: ${name}\nEmail: ${email}\nMessage: ${message}`
};

try {
await transporter.sendMail(mailOptions);
console.log('Email sent');
res.status(200).send('Email sent successfully');
} catch (error) {
console.error(error);
res.status(500).send('Error sending email');
}
};

14 changes: 14 additions & 0 deletions api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"mongoose": "^7.0.2",
"morgan": "^1.10.0",
"multer": "^1.4.5-lts.1",
"nodemailer": "^6.9.1",
"nodemon": "^2.0.22"
}
}
5 changes: 4 additions & 1 deletion api/routes/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ router.get('/profile',authController.profileAuth)
router.post('/logout', authController.logout)



router.post('/submitContactForm', homeController.submitContactForm)
router.post('/post',uploadMiddleware.single('file'), homeController.createPost)
router.put('/post',uploadMiddleware.single('file'), homeController.updatePost)
router.get('/post',homeController.getPosts)
router.get('/post/:id',homeController.getPost)





module.exports = router
1 change: 0 additions & 1 deletion client
Submodule client deleted from 52908b
Binary file added client/.DS_Store
Binary file not shown.
70 changes: 70 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.

The page will reload when you make changes.\
You may also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can't go back!**

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.

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.

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.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

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)

### Analyzing the Bundle Size

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)

### Making a Progressive Web App

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)

### Advanced Configuration

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)

### Deployment

This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)

### `npm run build` fails to minify

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)
5 changes: 5 additions & 0 deletions client/babel-plugin-macros.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
'fontawesome-svg-core': {
'license': 'free'
}
}
17 changes: 17 additions & 0 deletions client/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = function (api) {
api.cache(true);

return {
presets: [
"@babel/preset-env",
"@babel/preset-react"
],
plugins: [
"macros"
]
}
}




Loading

0 comments on commit 638813f

Please sign in to comment.