IT |
気になる、記になる… |
「iPhone 14 Pro/14 Pro Max」のバッテリー最大容量が1年経たずに大幅に低下していることが多数報告される |
https://taisy0.com/2023/08/13/175304.html
|
iphone |
2023-08-13 04:33:28 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
[Pythonで]ICMPv6NDPパケット通信~NSメッセージ~ |
https://qiita.com/Gravitas/items/ac1aae5db36933af1570
|
icmpv |
2023-08-13 13:45:53 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
プライベートサブネットでFargateを使う環境をCloudFormationで用意する |
https://qiita.com/bd8z/items/daa1d08980c0c9c65c46
|
awscli |
2023-08-13 13:46:24 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
【未経験開発 Rails + React + Docekr + Terraform + AWS + GitActions】 職場の課題を解決するアプリ開発 |
https://qiita.com/mkame/items/655a04688998ae43214a
|
ekrterraformawsgitactions |
2023-08-13 13:44:22 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
【未経験開発 Rails + React + Docekr + Terraform + AWS + GitActions】 職場の課題を解決するアプリ開発 |
https://qiita.com/mkame/items/655a04688998ae43214a
|
ekrterraformawsgitactions |
2023-08-13 13:44:22 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
【未経験開発 Rails + React + Docekr + Terraform + AWS + GitActions】 職場の課題を解決するアプリ開発 |
https://qiita.com/mkame/items/655a04688998ae43214a
|
ekrterraformawsgitactions |
2023-08-13 13:44:22 |
技術ブログ |
Developers.IO |
EC2 인스턴스에서 정기적으로 NICE DCV의 라이센스가 사용 가능한지 확인해 보기 |
https://dev.classmethod.jp/articles/jw-to-check-whether-licenses-for-nice-dcv-are-available-on-an-ec2-instance-on-a-regular-basis/
|
EC 인스턴스에서정기적으로NICE DCV의라이센스가사용가능한지확인해보기안녕하세요클래스메소드김재욱 Kim Jaewook 입니다 이번에는EC 인스턴스에서정기적으로NICE DCV의라이센스가사용가능한지확인하는방법에대해서정리해봤습니다 NICE D |
2023-08-13 04:45:36 |
海外TECH |
DEV Community |
Storing image from React formData to Cloudinary using Node/Express API |
https://dev.to/meghannfh/storing-image-from-react-formdata-to-cloudinary-using-nodeexpress-api-1c6a
|
Storing image from React formData to Cloudinary using Node Express APII won t waste your time Chances are if you ve ended up here you ve run into the same issue that plagued me for months or you re reading this because I mentioned it in my Twitter Prerequisites You re making a fullstack app using MERN and using MVC You re trying to send form data that includes image file data in your POST requestSomething is wrong with the incoming request particularly the image data parsing the path I m going to assume you have everything else working and you understand your folder structure I used Axios to send my requests from my React frontend to my backend You don t need to Backend Install Cloudinary and Multer dependencies if you haven t already Grab your Cloundiary CLOUD NAME API KEY and API SECRET from your Cloudinary dashboard Navigating to your Cloudinary dashboard Grab these values and save them in your env Set up your Cloudinary middleware file I named mine cloudinary js Here you ll use your keys for the configuration Make sure you re using the right file path for your project to access those keys in your env file Ex const cloudinary require cloudinary v require dotenv config path config env cloudinary config cloud name process env CLOUD NAME api key process env API KEY api secret process env API SECRET module exports cloudinary Set up your Multer middleware file Mine is named multer js and it s in the same middleware file as my cloudinary js I used the following configuration const multer require multer const path require path module exports multer storage multer diskStorage fileFilter req file cb gt let ext path extname file originalname if ext jpg amp amp ext jpeg amp amp ext png amp amp ext PNG req fileValidationError Forbidden extension return cb null false req fileValidationError cb new Error File type is not supported false return cb null true Set up your POST route for creating a new post item whatever to grab the image file I used the MVC file structure so my routes are in their own routes folder All my routes for posts are in a file called posts js You ll add upload single after the URL in your POST route Note that I have multer listening for my image data that will come through under the name file You can name yours whatever you want but it needs to match what you named that input in your form in the frontend const express require express const router express Router const postsController require controllers posts const upload require middleware multer router post addPost upload single file postsController addPost module exports router For reference here s what my input looks like in my React frontend I ve set the name to file as well Set up your controller function for adding the new item I have my controller functions in a post js file in a controller folder I used destructuring to grab my values You don t have to do this You can just use req body myProperty for example NOTE All values that are NOT the file data are preceded with req body To grab the file path you can destructure the way I did or you use req file path const Post require models Post const mongoose require mongoose const cloudinary require middleware cloudinary module exports addPost async req res gt const prompt media size canvas description req body const path req file Right under that I ran my body of code through a try catch block Since you ll need the unique image URL and the CloudinaryID to save to your db you ll want to do that first and wait for it to return a result try const result await cloudinary uploader upload path catch err res status json err err message console error err After awaiting the result from cloudinary we ll want to create our new post I have a property in my schema for file which holds the result secure url this is the unique URL for my image and cloudinaryId holding result public id the id for that image now stored in my media library in cloudinary I need the id in order to delete later on let newPost await Post create prompt prompt media media size size canvas canvas file result secure url don t forget to append secure url to the result from cloudinary cloudinaryId result public id append publit id to this one you need it to delete later description description user req user id The whole code block for my addPost function looks like this addPost async req res gt const prompt media size canvas description req body const path req file try const result await cloudinary uploader upload path let newPost await Post create prompt prompt media media size size canvas canvas file result secure url don t forget to append secure url to the result from cloudinary cloudinaryId result public id append publit id to this one you need it to delete later description description user req user id res status json newPost catch err res status json err err message console error err Okay hopefully that s working for you I m sorry if you get red text in the console screaming at you Frontend Install Axios if you want and import it import axios from axios Make sure you have your form coded out Here s a simplified example of what I had in my AddPostForm React component I left out the arrays I was mapping through to populate my selection elements const AddPostForm gt return lt div gt lt form onSubmit handleSubmit gt lt div gt lt label htmlFor prompt gt title lt label gt lt input type text name prompt placeholder title gt lt div gt lt div gt lt label htmlFor media gt media lt label gt lt div gt lt select name media gt mediaList map medium idx gt lt option key idx value medium gt medium lt option gt lt select gt lt div gt lt div gt lt div gt lt label htmlFor size gt size lt label gt lt div gt lt select name size gt sizesList map size idx gt lt option key idx value size gt size lt option gt lt select gt lt div gt lt div gt lt div gt lt label htmlFor canvas gt canvas lt label gt lt div gt lt select name canvas gt canvasList map canvas idx gt lt option key idx value canvas gt canvas lt option gt lt select gt lt div gt lt div gt lt div gt lt label htmlFor description gt description lt label gt lt textarea type textarea name description placeholder Tell us about this piece gt lt textarea gt lt div gt lt div gt lt input type file name file gt lt div gt lt button gt submit lt button gt lt form gt lt div gt export default AddPostFormImport useRef from react call it at the top of your component to declare a ref and add it to your form element If you don t know much about the useRef hook and or have never used it before you can read more about it here I got this tip from a senior dev who took a look at my code with me He suggested I use useRef to grab my form data import useRef from react const AddPostForm gt const formRef useRef return lt form onSubmit handleSubmit ref formRef gt lt form gt export default AddPostFormDeclare and define your handleSubmit function Create a new FormData object and pass in the ref we declared earlier appending the current property const handleSubmit async e gt e preventDefault const formData new FormData formRef current Send and await the result of the POST request I set mine within a try catch block I honestly don t know if it s necessary but I m so used to doing it now The first argument in axios post is the URL of your POST route Make sure yours matches whatever you ve set it as The second argument is the data you want to send off In this case the formData we grabbed earlier NOTE With Axios you don t have to append json to parse the response as JSON because Axios does that for you NOTE After getting the response I reset the form data with formRef current reset const handleSubmit async e gt e preventDefault const formData new FormData formRef current try const res await axios post post addPost formData console log res data formRef current reset catch err console log err response data err I hope to God this worked for you Aside from Axios I was also using React s state container library Redux Redux holds the state in this case my posts and makes them available globally after wrapping my App js in a context It s not necessary to send the form data but it makes it so I don t have to manually refresh the page to see updates to my DB I was thinking about posting more about how I solve issues but dealing with markdown text editors is more of a pain than it s worth and I swear I spent more time editing this to get it formatted just the way I wanted it than I did actually figuring out my steps and writing them out |
2023-08-13 04:41:29 |
海外TECH |
DEV Community |
Top ReactJS Courses to Excel in Web Development |
https://dev.to/max24816/top-reactjs-courses-to-excel-in-web-development-5hbd
|
Top ReactJS Courses to Excel in Web Development Learn React by ScrimbaDiscover the ultimate React with the Learn React for Free course on Scrimba Serving as an ideal starting point for React beginners this course offers a comprehensive journey into modern React Tackle interactive coding challenges and construct eight engaging projects including a React info site an AirBnb Experiences clone a meme generator and a notes app Build a React info site Construct an AirBnb Experiences clone Develop a meme generator Create a notes app and Tenzies game React Class Component FundamentalsPlease note This course has been retired but you can still access the valuable content Ideal for React developers seeking to enhance their skills this course delves into class components equipping you to build intricate applications Topics covered include introduction to class components state and props management event handling lifecycle methods and component composition Full Modern React Tutorial on YouTubeDive into a comprehensive introduction to React with the Full Modern React Tutorial on YouTube Covering a wide spectrum of topics this course unveils React s potential From creating applications and components to applying dynamic values managing styles handling events and employing state this tutorial delivers a robust foundation Explore the React Dev tools list output props utilization component reusability useEffect hook data fetching custom hooks React Router controlled inputs form submission and more React TutorialEmbark on a comprehensive React journey with this tutorial that covers the basics and beyond Topics range from setting up a development environment to component usage state and props management event handling React hooks routing and deployment Experience a hands on approach through a structured series of lessons and exercises Learn React by codecademyPerfect for beginners React on Codecademy offers an interactive journey into React development Acquire foundational knowledge in HTML CSS and JavaScript as you explore topics such as React introduction component creation props and state management event handling lists and keys and forms React JS Certification Training CourseSimplilearn React JS Certification Training Course is a comprehensive online program to hone your React skills Delve into components JSX state and props management event handling hooks routing and deployment Benefit from video lectures readings coding assignments quizzes and a range of learning resources Edureka ReactJS Certification Training CourseUnlock the potential of React and Redux with Edureka s ReactJS with Redux Certification Training Suitable for beginners and intermediates this course covers React basics Redux components JSX state and props management events routing hooks context API and testing W Schools React CertificationsValidate your React expertise with the W Schools React Certification Exam Covering components JSX state and props events hooks routing and deployment this exam provides a formal recognition of your React skills While passing the exam showcases proficiency remember that it s just one aspect of your expertise |
2023-08-13 04:12:02 |
ニュース |
BBC News - Home |
Ministers face renewed pressure over boat crossings |
https://www.bbc.co.uk/news/uk-66490218?at_medium=RSS&at_campaign=KARANGA
|
boats |
2023-08-13 04:51:42 |
コメント
コメントを投稿