I am developing an app that requires image upload to S3 and the user can update his profile pic and username at the same time , my problem is how do you stop the image upload to aws S3 if the username update fails for some reason like having the same username existing in the database ie.duplicate keys , currently what i implemented was update the user image and get the location of the file in s3 and save that link in the database and if user updates his image i reach out to the s3 bucket and delete his previous file and the upload the new one , now the problem is if username update fails once and i try to update it again, the file gets uploaded to s3 and the name updates,but the user image doesnt and i never get a response from the server and end up having duplicate files in my bucket which is the old profile pic and the new pic which is undesirable, is there a solution?here is the stackoverflow post for code refrence , am outta luck here , i've been stuck with this for a while now :https://stackoverflow.com/questions/64155106/stop-image-upload-to-s3-if-username-update-fails-in-multer-s3
Submitted October 01, 2020 at 02:37PM by the_excelsior22
Thursday, 1 October 2020
[100% OFF] Get Started With NodeJS : For Beginners 2020
https://unitedaca.com/100-off-get-started-with-nodejs-for-beginners-2020-5/
Submitted October 01, 2020 at 02:03PM by codeeuler1
Submitted October 01, 2020 at 02:03PM by codeeuler1
Most popular GraphQL server implementations
https://blog.graphqleditor.com/graphql-servers/
Submitted October 01, 2020 at 01:44PM by oczekkk
Submitted October 01, 2020 at 01:44PM by oczekkk
Jira Clone BE - Nestjs
Hello guys,You can check my small project :) https://github.com/ozergul/jira-clone-backend-nestI coded with NestJs, TypeORM.
Submitted October 01, 2020 at 12:31PM by ozergul
Submitted October 01, 2020 at 12:31PM by ozergul
Can someone please explain this snippet?
So obviously there is a knowledge gap in my basics and hence can't figure this out-const validate = validations => {return async (req, res, next) => {console.log('check 3')await Promise.all(validations.map(validation => validation.run(req)));const errors = validationResult(req);if (errors.isEmpty()) {return next(); }res.status(400).json({ errors: errors.array() }); };};This is being called byapp.post('/api/create-user', validate([body('email').isEmail(),body('password').isLength({ min: 6 })]), async (req, res, next) => {// request is guaranteed to not have any validation errors.res.send("succ")});the body() function inside validate in app.post is from express-validatorNow, how is app.post calling that middleware function const validate? I don't understand how the arguments are passing.validations is the argument list there which should receive validate([body('email').isEmail(),body('password').isLength({ min: 6 })])right?But how is another brace opening saying return async (req, res, next) => { the first 2 lines are where my confusion isconst validate = validations => {return async (req, res, next) => {
Submitted October 01, 2020 at 11:59AM by kjroger94
Submitted October 01, 2020 at 11:59AM by kjroger94
What is "npm start config" and "npm start recovery" does here?
Heyhttps://github.com/andreapizzato/tez-recoveryIn the project above you're supposed to install dependencies and then run the test script, after that you run "npm start config" and "npm start recovery", which according to my simple understanding of npm means there is two npm scripts named config and recovery. but there is no such scripts in the package.json.Can someone tell me what npm is actually doing when those two commands are run?Thank you very much :)
Submitted October 01, 2020 at 08:38AM by Taro_Naza
Submitted October 01, 2020 at 08:38AM by Taro_Naza
Am I misunderstanding module.exports? Advice please.
Using node.js I am attempting to share/modify an array across files. I have a main function that calls separate commands contained in other files. Breakdown:shared-list.jsdeclares an empty list named 'shared'declares 'shared' as a module export.function1.jsDoes the following inside an execute function as part of function1.js's module.exportsdeclares a list utilizing: const list = require('../shared-list');pushes a value to 'list'prints 'list' to consolemain.jscalls function1.executedeclares a list utilizing: var list = require('../shared-list');prints 'list' to consoleWhen list is printed in function1 it always returns the expected value, but the value does not seem to persist when later called in main. I also noticed that the print statements happen in the reverse order than expected (main prints first followed by function1 module). If anyone is willing to help clarify what exactly I'm doing wrong I'd really appreciate it. If you need any more information please feel free to ask! Thanks.
Submitted October 01, 2020 at 08:54AM by PhilosophicalGeek
Submitted October 01, 2020 at 08:54AM by PhilosophicalGeek
Subscribe to:
Posts (Atom)