manikandanraji / youtubeclone-backend Goto Github PK
View Code? Open in Web Editor NEWYoutube Clone Backend (Express + Sequelize)
License: MIT License
Youtube Clone Backend (Express + Sequelize)
License: MIT License
Upon signing up this error is thrown: index.js:92 Uncaught (in promise) TypeError: Cannot read property 'data' of undefined at authenticate (index.js:92)
Hi @manikandanraji ,
Just wanted to know what is the use of asyncHandler wrapper function.
const asyncHandler = (fn) => (req, res, next) =>
Promise.resolve(fn(req, res, next)).catch(next);
module.exports = asyncHandler;
Thank you
I am currently trying to redo your project on my own without heroku, hosted on localhost. Whenever I use postman to test the endpoints, I keep getting this error on my console:
Server started at http://localhost:5000
Error
at Query.run (C:\Users\donal\videos\Web-Developement\videojs\vc-be\server\node_modules\sequelize\lib\dialects\postgres\query.js:50:25)
at C:\Users\donal\videos\Web-Developement\videojs\vc-be\server\node_modules\sequelize\lib\sequelize.js:313:28
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async PostgresQueryInterface.insert (C:\Users\donal\videos\Web-Developement\videojs\vc-be\server\node_modules\sequelize\lib\dialects\abstract\query-interface.js:297:21)
at async model.save (C:\Users\donal\videos\Web-Developement\videojs\vc-be\server\node_modules\sequelize\lib\model.js:2424:35)
at async Function.create (C:\Users\donal\videos\Web-Developement\videojs\vc-be\server\node_modules\sequelize\lib\model.js:1336:12)
at async C:\Users\donal\videos\Web-Developement\videojs\vc-be\server\controllers\auth.js:12:18
This is my current code for auth.js:
const { Op } = require("sequelize");
const { User } = require('../sequelize');
const bcrypt = require("bcryptjs");
const jwt = require("jsonwebtoken");
const asyncHandler = require('../middlewares/asyncHandler');
// exports.signup = asyncHandler(async (req, res, next) => {
// console.log('this function works');
// });
exports.signup = asyncHandler(async (req, res, next) => {
const user = await User.create(req.body);
await user.save();
res.status(200).json({ success: true, data: token });
console.log('this function works');
});
Did you ever experience something like this before?
Hi Manikandan,
please make changes on storage structure for work on google drive
because edu gmails are not limited on gdrive disc quota & so much better than cloudinary.
waiting for your response
finest regards
Which folder should I make a .env file?
hi this is the best !! i set up project with Postgress from heroku- however I am not sure that it is connecting for it wont allow sign up from sign up page. do i have to configurer the db first somehow in heroku??
thanks so much
Does this repo have any test support? Something like:
npm run mocha
describe('UserModel', function(){
[...]
it('should list users', async () => {
cheers
When running 'npm run dev' the error is: Err Missing script: "dev"
Can you show me how to fix?
I have set up the project with heroku postgress and put the other secret key in there.
however when i run the npm run dev, i get a CANNOT/GET error .
Is there anything I might be missing? Any help would be appreciated.
thanks- chris
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.