投稿時間:2022-06-09 22:36:55 RSSフィード2022-06-09 22:00 分まとめ(39件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
AWS AWS Startups Blog A Startup’s Guide to AWS Services Series 6: Choosing an Architecture https://aws.amazon.com/blogs/startups/a-startups-guide-to-aws-services-series-6-choosing-an-architecture/ A Startup s Guide to AWS Services Series Choosing an ArchitectureThis installment of The Startup Guide to AWS Services video series covers AWS compute models and the advantages of serverless architecture While outlining the various operational models Principal Startup Solutions Architect Igor Geyfman identifies which tasks AWS manages and which are up to the startup 2022-06-09 12:02:49
python Pythonタグが付けられた新着投稿 - Qiita Streamlitの新機能マルチページを触ってみる https://qiita.com/nockn/items/f40a80cc79fcb358083c httpsb 2022-06-09 21:42:55
js JavaScriptタグが付けられた新着投稿 - Qiita JavaScriptでゲームを作る🎮 その3 https://qiita.com/sfjwr/items/5400993e87075f1657b1 javascript 2022-06-09 21:37:19
js JavaScriptタグが付けられた新着投稿 - Qiita [JavaScript] 非同期処理Promiseサンプル多めで丁寧にわかりやすく https://qiita.com/Bashi50/items/57af8fb7b19e69137141 javascript 2022-06-09 21:32:40
Ruby Rubyタグが付けられた新着投稿 - Qiita 【Rails】ActionCable~用語について~ https://qiita.com/wark_ran/items/7fd14d04a53bb854d13f actioncable 2022-06-09 21:48:23
Ruby Rubyタグが付けられた新着投稿 - Qiita 【Laravel・Rails】親が削除されたらリレーション先の子テーブルも削除する方法まとめ https://qiita.com/kat0/items/1b002e41a488093a78c0 schematableposts 2022-06-09 21:01:27
Ruby Railsタグが付けられた新着投稿 - Qiita 【Rails】ActionCable~用語について~ https://qiita.com/wark_ran/items/7fd14d04a53bb854d13f actioncable 2022-06-09 21:48:23
Ruby Railsタグが付けられた新着投稿 - Qiita 【Laravel・Rails】親が削除されたらリレーション先の子テーブルも削除する方法まとめ https://qiita.com/kat0/items/1b002e41a488093a78c0 schematableposts 2022-06-09 21:01:27
海外TECH Ars Technica Xbox’s continued cloud climb: Samsung TVs, more nations, games outside Game Pass https://arstechnica.com/?p=1859893 xboxes 2022-06-09 12:27:27
海外TECH MakeUseOf The 4 Best Free Video Watermark Removal Services Online https://www.makeuseof.com/best-video-watermark-removal-services/ The Best Free Video Watermark Removal Services OnlineWatermarks on videos can be rather problematic especially when they re put there by editing tools So here are the four best free removal tools 2022-06-09 12:30:13
海外TECH MakeUseOf How to Play Spotify on Waze https://www.makeuseof.com/how-to-play-spotify-on-waze/ android 2022-06-09 12:15:13
海外TECH MakeUseOf How to Install the iOS 16, watchOS 9, and macOS Ventura Developer Betas https://www.makeuseof.com/how-to-install-apple-developer-beta-updates/ updates 2022-06-09 12:13:23
海外TECH DEV Community How I Created an Ecommerce App from Scratch Using React Native and Medusa https://dev.to/medusajs/how-i-created-an-ecommerce-app-from-scratch-using-react-native-and-medusa-56ej How I Created an Ecommerce App from Scratch Using React Native and MedusaReact Native is a cross platform mobile app framework that allows you to build native mobile applications for iOS and Android using JavaScript It was developed by Meta Platforms Inc and it is currently among the most popular JavaScript frameworks with a huge active community behind it Medusa is an open source headless commerce platform that allows you to create stores in a few minutes It includes every feature a store needs such as order management customers payments products discounts and a lot more In this tutorial you are building a React Native ecommerce mobile application with Medusa For this part you are going to create two screens one for all products and the other for the product info You can also find the source code of the application on the GitHub PrerequisitesBefore you start with the tutorial make sure you have Node js v or greater installed on your machine Set Up Medusa ServerThe first step is to setup the Medusa server where the backend and APIs are handled You can install the Medusa CLI on your machine by running the following command npm install g medusajs medusa cliOnce the CLI is installed successfully run the following command to create a Medusa project medusa new my medusa store seedThe seed option is used to add dummy data such as products and users to the store Change to the newly created directory my medusa store and run the following command to start the medusa server npm startIt is recommended to add a storage plugin to be able to add products with images in Medusa You can use MinIO AWS S or Spaces Set Up Medusa AdminMedusa has a very powerful admin dashboard where you can manage your products payments transaction and more This is very easy to setup however it is optional so if you want you can skip this section In a separate directory clone the Medusa Admin git clone medusa adminOnce it is cloned you should see a new directory named medusa admin Navigate to the new directory and run the following command to install the dependencies of the project npm installFinally make sure that the Medusa server is still running and start the admin panel server by running the following command npm run developNow open your browser and navigate to localhost and you should see the login page for admin panel Login in to the admin with the below credentials Email admin medusa test comPassword supersecretThe seed option you used earlier adds an admin user with the email and passwordOnce you are logged in successfully choose Products from sidebar and you should see the list of products in your store If you are experiencing connection issues it s most likely because of CORS issues Check here how to fix it You can also create a new product by clicking on the New Product button Add information for your product such as a name description handle variants images prices and a lot more Set Up React Native Ecommerce ProjectNow that you have the store backend and admin panel ready it is time to start working on the react native ecommerce app In this tutorial you are using Expo CLI to build the app Run the following command to install the Expo CLI npm install g expo cliOnce the CLI is installed successfully run the following command to create a new react native ecommerce project expo initYou will be promoted with some questions You can follow the below code for the answers What would you like to name your app …medusa storeChoose a template ›blank a minimal app as clean as an empty canvasDownloaded template Using Yarn to install packages Pass npm to use npm instead Installed JavaScript dependencies Your project is ready To run your project navigate to the directory and run one of the following yarn commands cd medusa store yarn start you can open iOS Android or web from here or run them directly with the commands below yarn android yarn ios yarn webOnce the project is created successfully you should see a new directory named medusa store Navigate to the new directory and run the following command to install a few other dependencies expo install react native screens react native router flux react native reanimated rn responsive screen react native safe area context expo vector icons react native gesture handler axiosreact native screens is used to expose native navigation container components to React Native react native router flux provides API that helps users navigate between screens react native reanimated creates smooth animations and interactions that run on the UI thread rn responsive screen is a small package used for responsiveness in the app react native safe area context is a flexible way to handle safe areas react native gesture handler provides native driven gesture management APIs for building the best possible touch based experiences axios is a promise based HTTP Client to easily send requests to REST APIs and perform CRUD operations expo vector icons includes popular icons sets which you can use in the app After the packages are installed successfully start the development server by running the following expo startYou can either scan the QR code using your device or run the app on an Android iOS simulator Once the app is shown on your mobile you should see a similar screen This is a basic react native code in the App js file Set Up RoutesIn this section you ll set up different routes in your app Before setting up the routes you have to create a few screens Create a new folder named screensand inside it create a new file named Products js Inside Products js insert the following code import StyleSheet Text View from react native export default function Products return lt View style styles container gt lt Text gt Product Screen lt Text gt lt View gt const styles StyleSheet create container flex backgroundColor fff alignItems center justifyContent center For now it contains a very simple Text component Now that you have a screen setup you can continue to add routes to the project Replace the code inside of the App js with the following import Router Scene Stack from react native router flux import Products from screens Products export default function App return lt Router gt lt Stack key root gt lt Scene key products component Products hideNavBar gt lt Stack gt lt Router gt In the above code you are using react native router flux to create the navigation Router is used as a parent component and each Scene represents one screen For now you have just one screen Save the file and you might see an error similar to this Error Requiring module node modules react native reanimated src Animated js which threw an exception Error Reanimated failed to create a worklet maybe you forgot to add Reanimated s babel plugin It is because that react native router flux uses react native reanimated and in order to make it work you need to add it to babel config js Open the babel file from your directory and add the below line after presents plugins react native reanimated plugin Save the file and restart the server with the following command expo start cThe option c clears the cache before running the server If you see the error “Invariant Violation Tried to register two views with the same name RNGestureHandlerButton delete the node modules directory and use Yarn to re install the dependencies Products List ScreenCreate a new folder in the root directory named components In the components folder create files Button js ProductCard js and Header js In the Button js file insert the following code to create a basic button component import View Text StyleSheet from react native import React from react import widthToDp from rn responsive screen export default function Button title onPress style textSize return lt View style styles container style gt lt Text style styles text fontSize textSize textSize widthToDp onPress onPress gt title lt Text gt lt View gt const styles StyleSheet create container backgroundColor CAFF padding width widthToDp alignItems center justifyContent center borderRadius text color fff fontWeight bold Similarly in the Header js insert the following code to create a simple header component import View Image StyleSheet Text from react native import React from react export default function Header title return lt View style styles container gt lt Image source uri style styles logo gt lt Text style styles title gt title lt Text gt lt View gt const styles StyleSheet create container flexDirection row justifyContent space between alignItems center marginBottom title fontSize fontWeight logo width height The last one is ProductCard js It is the main component in which you render the product data import View Text Image StyleSheet from react native import React from react import widthToDp heightToDp from rn responsive screen import Button from Button export default function ProductCard key product return lt View style styles container key key gt lt Image source uri product thumbnail style styles image gt lt Text style styles title gt product title lt Text gt lt Text style styles category gt product handle lt Text gt lt View style styles priceContainer gt lt Text style styles price gt product variants prices amount lt Text gt lt Button title BUY gt lt View gt lt View gt const styles StyleSheet create container shadowColor borderRadius marginBottom heightToDp shadowOffset width height shadowOpacity shadowRadius elevation padding width widthToDp backgroundColor fff image height heightToDp borderRadius marginBottom heightToDp title fontSize widthToDp fontWeight bold priceContainer flexDirection row justifyContent space between alignItems center marginTop heightToDp category fontSize widthToDp color marginTop price fontSize widthToDp fontWeight bold In the above code the product price is divided by because in Medusa the prices are hosted on the server without decimals Create a new folder named constants and inside it create a new file named url js with the following content const baseURL export default baseURL In the above code you define your Medusa server s base URL To be able to connect from your device to the local server you must change the value of baseURL to your machine s IP address You can refer to this guide to learn how to find your IP address That s it for the components Now replace the code in the Products js with the following import ScrollView StyleSheet TouchableOpacity View from react native import React useEffect useState from react import ProductCard from components ProductCard import widthToDp from rn responsive screen import axios from axios import Header from components Header import Actions from react native router flux import baseURL from constants url export default function Products const products setProducts useState function fetchProducts axios get baseURL store products then res gt setProducts res data products useEffect gt fetchProducts return lt View style styles container gt lt Header title Medusa s Store gt lt ScrollView gt lt View style styles products gt products map product gt lt ProductCard key product id product product gt lt View gt lt ScrollView gt lt View gt const styles StyleSheet create container flex paddingTop backgroundColor fff alignItems center justifyContent center products flex flexDirection row flexWrap wrap width widthToDp paddingHorizontal widthToDp justifyContent space between In the code above you call fetchProducts when the screen loads using useEffect In the fetchProducts function you use axios to fetch the products from the Medusa server and save it in the state Once you fetch the products you render them using the ProductCard component Save the file and make sure that Expo and the Medusa server are running Then open the app on your device and you should see on the home screen the products from your Medusa server Product Info ScreenIn this section you ll create the Product Info screen where the user can see more details about the product In the screens directory create a new file named ProductInfo js and for now you can use it to render a simple Text component import View Text from react native import React from react export default function ProductInfo return lt View gt lt Text gt Product Info Screen lt Text gt lt View gt Then add the import ProductInfo at the top of App js import ProductInfo from screens ProductInfo And add a new Scene component below the existing Scene component in the returned JSX lt Scene key ProductInfo component ProductInfo hideNavBar gt In the components directory create a new directory named ProductInfo and create inside it Image js with the following content import View TouchableOpacity Image StyleSheet from react native import React useEffect useState from react import widthToDp from rn responsive screen export default function Images images const activeImage setActiveImage useState null useEffect gt setActiveImage images url return lt View style styles imageContainer gt lt Image source uri activeImage style styles image gt lt View style styles previewContainer gt images map image index gt lt TouchableOpacity key index onPress gt setActiveImage image url gt lt Image source uri image url style styles imagePreview borderWidth activeImage image url gt lt TouchableOpacity gt lt View gt lt View gt const styles StyleSheet create image width widthToDp height widthToDp previewContainer flexDirection row justifyContent center alignItems center marginTop widthToDp imageContainer backgroundColor FFFB paddingBottom widthToDp imagePreview width widthToDp marginRight widthToDp borderColor CAFF borderRadius height widthToDp In the above component you display a main big image and below it the rest of the product images as thumbnails When the user press on one of the thumbnail images it is set as the active image and displayed as the main image In the Products js file replace the map function in the returned JSX with the following products map product gt lt TouchableOpacity key product id onPress gt Actions ProductInfo productId product id gt lt ProductCard product product gt lt TouchableOpacity gt You add a TouchableOpacity that navigates the user to the product info screen when they click on a product Using react router flux you pass the product ID from the home screen to the product info screen Then replace the code in ProductInfo js with the following import View Text ScrollView TouchableOpacity StyleSheet from react native import React useState useEffect from react import axios from axios import SafeAreaView from react native safe area context import Images from components ProductInfo Image import baseURL from constants url import Actions from react native router flux import Ionicons from expo vector icons export default function ProductInfo productId const productInfo setproductInfo useState null useEffect gt axios get baseURL store products productId then res gt setproductInfo res data product return lt SafeAreaView style styles container gt lt TouchableOpacity onPress gt Actions pop gt lt Ionicons style styles icon name arrow back outline size color black gt lt TouchableOpacity gt lt ScrollView gt productInfo amp amp lt View gt lt Images images productInfo images gt lt View gt lt ScrollView gt lt SafeAreaView gt const styles StyleSheet create container flex backgroundColor fff justifyContent center icon marginLeft To briefly explain the code snippet First you import all necessary components Then you fetch the product data in useEffect function and save it in the state Finally you display the images using the Images component Open the app now and click on any product on the home screen A new screen will open showing the product s images Now you ll display the product s information In the components folder inside the ProductInfo directory create a new file named MetaInfo js with the following content import View Text StyleSheet from react native import React useState from react import height heightToDp from rn responsive screen export default function MetaInfo product const activeSize setActiveSize useState return lt View style styles container gt lt View style styles row gt lt Text style styles title gt product title lt Text gt lt View gt lt Text style styles price gt product variants prices amount lt Text gt lt Text style styles star gt lt Text gt lt View gt lt View gt lt Text style styles heading gt Available Sizes lt Text gt lt View style styles row gt product options values map size index gt lt Text onPress gt setActiveSize index style styles sizeTag borderWidth activeSize index gt size value lt Text gt lt View gt lt Text style styles heading gt Description lt Text gt lt Text style styles description gt product description lt Text gt lt View gt const styles StyleSheet create container marginTop heightToDp backgroundColor fff borderTopLeftRadius borderTopRightRadius height heightToDp padding heightToDp title fontSize heightToDp fontWeight bold row flexDirection row justifyContent space between alignItems center price fontSize heightToDp fontWeight bold color CAFF heading fontSize heightToDp marginTop heightToDp star fontSize heightToDp marginTop heightToDp sizeTag borderColor CAFF backgroundColor FFFB color paddingHorizontal heightToDp paddingVertical heightToDp borderRadius heightToDp marginTop heightToDp overflow hidden fontSize heightToDp marginBottom heightToDp description fontSize heightToDp color aaa marginTop heightToDp In the above component you render the product title price description and variants For the product variant you map all the variants and when a user press on one of them you set that variant as active Save the MetaInfo js file and import it at the top of screens ProductInfo js import MetaInfo from components ProductInfo MetaInfo Then in the returned JSX add the MetaInfo component below the Images component lt MetaInfo product productInfo gt Save the changes and check the app now The product info screen now shows details about the product What s Next This article gives you the basis to creating a Medusa and React Native ecommerce app Here are some more functionalities you can add using Medusa Add a cart and allow adding products to cart Add a payment provider using Stripe Add a search engine using MeiliSearch Check out the documentation for what more you can do with Medusa Should you have any issues or questions related to Medusa then feel free to reach out to the Medusa team via Discord 2022-06-09 12:53:00
海外TECH DEV Community What is OAuth? Setting up Github OAuth with Supabase https://dev.to/supabase/what-is-oauth-setting-up-github-oauth-with-supabase-44le What is OAuth Setting up Github OAuth with SupabaseTL DR In this post I will do a quick intro to the OAuth protocol and show how to use OAuth with Supabase by implementing Sign in with Github What is OAuth Setting up Github OAuth with SupabaseOAuth is an open protocol which allows users to log into your service with an account that they already have with a third party provider e g Google Github Twitter etc  The benefit is that the user doesn t need to maintain a separate set of credentials for each app or web service that they interact with they can just log in with Google The protocol depends on grants and tokens and works by issuing access tokens to the third party client with the approval of the resource owner img alt Figure OAuth based authentication between a User and a Supabase based web app Gotrue tenant refers to the Supabase Auth server lt br gt height src dev to uploads s amazonaws com uploads articles tddwhrhiswqmr png width Figure OAuth based authentication between a User and a Supabase based web app Gotrue tenant refers to the Supabase Auth server Some of the benefits of using OAuth for authentication are Improved security and privacy The OAuth framework uses SSL to securely store access tokens which protects user data on the wire Greater control and flexibility OAuth allows the user to choose where and how their data can be accessed giving them greater control and flexibility Better agility and user experience OAuth lifts and shifts the responsibility of API authentication from developers to the external provider allowing developers to focus on the application logic rather than writing and maintaining a new auth flow from scratch Now that we know the value of using OAuth let s set up authentication based on native OAuth in Supabase using Github as the external provider The full list of supported external providers can be found here What is Supabase Supabase is an open source backend for apps It works with any client or framework e g Javascript React Next js Python Django Mobile Flutter iOS and comes with a free tier which is good for two free backends It hosts all your data in the cloud and comes with auth realtime and cloud functions Learn about Supabase s Auth system Using OAuth in SupabaseSupabase allows you to set up auth integrations with a long list of OAuth providers Once your Supabase account is set up you will be able to access the Supabase dashboard From here go to All Project gt New Project Give your project a name and set the database password You can also choose the region and adjust the pricing plan based on the requirements of your project Once you create a new project Supabase will begin provisioning your database and set up your API endpoint This process may take a few minutes Once your project is ready go to Settings gt API and make a note of the Config URL Now let s set up Supabase with Github OAuth Once your project is set up and you have your Config URL log into Github and go to Settings gt Developer Settings gt OAuth Apps and click on Register a new application Give the OAuth application a name and copy lt YOUR CONFIG URL gt auth v callback in the Authorization callback URL For the homepage URL add the URL to your app In this example we will create a react app that is running locally on port Once the fields have been filled click on the Register application Once the application is created click on the Generate a new client secret button and copy the value that is generated In Supabase go to Authentication gt Settings and scroll down to the External OAuth Providers section and enable the Github option Paste the Github client ID as well as Github Secret in their respective fields and save Next let s verify this functionality by creating a simple react app app to sign in with Github OAuth on the front end Create the app by running the following command npx create react app supabase oauth exampleOnce the app is created change directory into the app and install the Supabase npm package by running cd supabase oauth examplenpm install supabase supabase jsBefore creating an instance of createClient which will be used to connect to the Supabase project make a note of the project s public API which can be found by going to Settings gt API In the App js file create an instance of createClient which will be used to connect to your Supabase project by adding the following The first argument for createClient is the URL Config For the second argument copy the Project public API key import createClient from supabase supabase js const supabase createClient lt https zcc import createClient from supabase supabase js const supabase createClient lt gt eyJhbGciOiJIUzINiIsInRcCIIkpXVCJ import createClient from supabase supabase js const supabase createClient eyJhbGciOiJIUzINiIsInRcCIIkpXVCJ Next replace the App function with the following which adds a sign in button that will then redirect users to sign in using Github OAuth const provider github function App const user setUser useState null async function userStatus const user supabase auth user setUser user async function signIn await supabase auth signIn provider provider async function signOut await supabase auth signOut setUser null useEffect gt userStatus window addEventListener hashchange function userStatus if user return lt div className App gt lt h gt Hello user email lt h gt lt button onClick signOut gt Sign out lt button gt lt div gt return lt div className App gt lt h gt Sign in using Github OAuth lt h gt lt button onClick signIn gt Sign In lt button gt lt div gt Start the development server by running the following from the terminal npm startOn a browser go to http localhost to access the app Clicking on the Sign in button will redirect you to Sign in with Github Log in using your Github credentials and authorize your app You will then be redirected back to the app and be signed in You can then also sign out using the Sign out button By following this process you can configure your Supabase project with any supported OAuth providers After setting up your project with a provider you just need to pass in the provider name await supabase auth signIn provider lt YOUR PROVIDER gt ConclusionSupabase makes it very simple to use OAuth and allows you to extend access control to a large number of applications You can easily control access using the Supabase Console or from the API So say goodbye to traditional password management and get access to secure user data without complex user onboarding workflows Now become a Supabase developer today by starting a new project on our free tier 2022-06-09 12:38:14
海外TECH DEV Community Understanding CORS Misconfiguration https://dev.to/nathan20/understanding-cors-misconfiguration-6eo Understanding CORS MisconfigurationIn this article I will explain what cross origin sharing is give some examples and real case scenario and finally how to prevent from this misconfiguration CORS ExplainedCross origin sharing is a browser mechanism which controlto access resources from another domain This can be used to share resources between different domains or to allow a web page to access resources from a domain that is not the same as the domain from which the web page was served CORS was originally create to add more flexibility yo same origin policy mechanism SOP SOP prevent website to attacking each other by implement a strict policy which describe how website can reach each other The cross origin resource sharing uses a suite of HTTP headers that define trusts web domains origins and associated properties Allow an OriginIn order to allow a specific origin the header Allow Control Origin has to be included in the response from a website which receive a CORS request The browser compare the value of the header with the requesting website s origin and allow access if they correspond Concert example A website wants to use a resource from a remote host GET data HTTP Host remote website comOrigin The server of the requesting website remote website com return the following response HTTP OK Access Control Allow Origin The browser will compare the response and in this case the browser will permit because the origins match In the case where there is no restriction the server will return wildcard into the server header Allow CredentialsCross origin resource requests are sent without credentials such as cookies and the Authorization header by default When credentials are supplied to the cross domain server the CORS Access Control Allow Credentials header is set to true allowing reading of the response Then the browser will permit the requesting website to get the response Access Control Allow Credentials true Security IssuesUnfortunately give flexibility often generate security issues If a website s CORS is poorly configured it is can potentially lead to cross domain attacks Take a bank virtual as example suppose that an attacker stole user s cookies the attacker will send the following request GET account details HTTP Host virutal bank comOrigin Cookie sessionid Then the bank s server will respond HTTP OKAccess Control Allow Origin Access Control Allow Credentials trueThe response s server allows the malicious attacker to send cross request and that the request can include cookies In this case because the App reflects arbirtrary subdomain from the origin header theoretically every domains can access ressources from this vulnerable bank s website In result with a bad CORS configuration an attacker could read sensitive bank s information Does CORS protect against CSRF CORS does not specifically protect against CSRF but it does add an extra layer of security If an attacker does manage to exploit a CSRF vulnerability they will only be able to access resources that are allowed by the CORS policy How to protect against CORS Misconfiguration Misconfigurations are the primary cause of CORS vulnerabilities Proper setting is critical to preventing these threats The sections that follow outline several viable CORS defenses If a web resource includes sensitive information make sure the origin is appropriately stated in the Access Control Allow Origin header Allow only trustworthy websites access to the resource It is especially dangerous to dynamically reflect origins from cross origin requests without validation Use the Access Control Allow Origin null header as little as possible Cross origin resource calls from internal documents and sandboxed requests can have a null origin specified For both private and public servers CORS headers should be appropriately established in terms of trustworthy origins Internal networks should be free of wildcards When internal browsers may access untrusted external sites relying on network setup alone to safeguard internal resources is insufficient Check your API security at www blstsecurity com 2022-06-09 12:35:23
海外TECH DEV Community Convert your website into an android app using capacitor 😱. https://dev.to/narottam04/convert-your-website-into-an-android-app-using-capacitor--5bh2 Convert your website into an android app using capacitor According to Atwood s Law Any application that can be written in JavaScript will eventually be written in JavaScript In this article we will learn how to convert a website or web application to an android app that can be deployed on the Android play store or installed on a mobile device using a library from Ionic called a capacitor I will use react for this demo but you can use any other framework or even plain old JavaScript PrerequisiteA production build folder Most frameworks have a build command to create a build folder for you If you are using vanilla JavaScript add all your assets and files to a folder Android studio Step Create a react application We will begin by creating a react application using the following commands You can skip steps and if you already have an existing project and build folder npx create react app my appcd my appNow to run our react application we use the below commandnpm startOur demo application will look something like this Step Create a Build folder for your application A build folder is crucial in converting our react application to an android application We use the following command to create a build folder for our react application If you are using another framework it might have different commands so I recommend reading the documentation for the framework you are using If you are using plain JavaScript create a folder that contains all your files and assets npm run build Step Install capacitorTo create our android application let s first install capacitor cli and its core library npm install capacitor cli capacitor corenpx cap initThe first question will be to enter the name of your application and the second one will be to enter the package id of application com yourAppName android Now open the capacitor config ts file in webDir and enter the name of your build folder if it is different Step Create your android applicationTo create an android application make sure you have installed and configured your android studio properly Assuming everything above has been set up run the following command npm install capacitor androidnpx cap add androidWith the first command we will download the capacitor android library into our project and with the second command we will generate the android code Now it s time to open the android studio using the following command npx cap open androidAlternatively you can open Android Studio and import the android directory as an Android Studio project It will take some time for your application to open but it should look something like this once it is ready By clicking on the play button in android studio you can now run your android application The emulator screen on my potato laptop was entirely black for some reason However if you have the same problem as me create an apk and run it either on an android simulator like Nox player for windows or on an actual android device Click on Build gt gt Build Bundle s APK s gt gt Build APK s to generate a installable debug apk file To submit the app to the play store we need to create a signed bundle but now for testing we will create a debug application It will show a similar message in the bottom right corner if successfully built click on locate folder or navigate to android app build outputs apk Now you can run your application either on your android phone or android simulator like nox player etc Hurray it works Bonus Section Create a custom splash screen for your android applicationAn app would not be complete without a customized splash screen and icon If we want to create a splash screen and custom icon we must install the capacitor plugin first npm install g cordova rescordova res expects a Cordova like structure place one icon and one splash screen file in a top level resources folder within your project like so resources ├ーandroid └ーicon background png └ーicon foreground png├ーicon png└ーsplash pngI am using icon and splash from the project I worked on for two months With my new project newbie cryptocurrency investors will be able to try investing in cryptocurrencies without any risk If you are interested in learning more subscribe to my newsletter to receive updates on Next run the following to generate icons and splash screens of different sizes for your app cordova res android skip config copyThe command should generate two folder icons and a splash You will not need to configure anything because all assets generated on this folder will be copied to your Android code folder Now to test our splash screen follow step again ReferenceCapacitor DocsI hope this post was informative Feel free to comment or reach out to me if you have any questions In the next blog we will be adding a push notification feature to our capacitor app For more such insights checkout my blog website blog webdrip in 2022-06-09 12:31:55
海外TECH DEV Community MEVN stack tutorial | Build a CRUD app using Vue 3, Node, Express & MongoDB https://dev.to/signoz/mevn-stack-tutorial-build-a-crud-app-using-vue-3-node-express-mongodb-bmp MEVN stack tutorial Build a CRUD app using Vue Node Express amp MongoDBThis tutorial was originally posted on SigNoz Blog and is written by Sai DeepeshMEVN stack is a popular Javascript software stack that has become very popular in recent times to build powerful web applications MEVN stack involves four technologies to build an end to end web application namely MongoDB Expressjs Vuejs and Nodejs What is the MEVN stack Technology stacks help developers build end to end applications But it s often quite confusing to choose your stack amongst a myriad of choices Javascript is one of the most popular programming languages which caters to both frontend and backend technologies MEVN is one of the most popular full stack Javascript stacks that can be used to build scalable production ready web applications MEVN stack consists of four different technologies to build an end to end application It includes MongoDBExpress jsVue jsNode jsLet s learn about each of these technologies in brief What is MongoDB MongoDB is a highly scalable and flexible document database with efficient querying and indexing MongoDB stores data in flexible JSON like documents meaning fields can vary from document to document and data structure can be changed over time What is Express js Express is a minimal and flexible Node js web application framework that provides robust features for web and mobile applications It provides a myriad of HTTP utility methods and middleware at your disposal which makes creating a robust API quick and easy Express provides a diverse layer of fundamental web application features What is Vue js According to its documentation Vue js is a progressive JavaScript framework for building user interfaces It is approachable  performant and versatile in building single page web applications It is one of the popular frameworks used to simplify web development VueJS focuses on the view layer It has a very easy learning curve with a simple API which makes it one of the most loved frameworks What is Node js Node js is an open source runtime environment and library used to run web applications outside the client s browser It is mainly used for server side programming It is asynchronous event driven and highly scalable to write servers and databases In this tutorial we will build a simple To Do app with functionalities to list add and delete tasks using the MEVN stack PrerequisitesNodejs vVue CLI vVue vnodemonconcurrently Creating Server with Nodejs ExpressCreate a folder with client and server folders inside the project directory Get into server and initialize an npm project using the following command Initialize npm project npm init yInstall required packages npm i express mongoose body parser cors dotenvSetup a basic hello world server const express require express const app express const PORT app get req res gt res send Hello World app listen PORT gt console log App is listening at http localhost PORT To have a better developer experience install nodemon amp concurrently as dev dependencies and update scripts JSON in package json nodemon It automatically restarts the node application when file changes in the directory are detected concurrently It is used to run multiple commands parallelly Install nodemon amp concurrently npm i D nodemon concurrentlyUpdate scripts in package json scripts start server nodemon index js ignore client Whenever there are new changes in our application code it will automatically refresh our application Update the scripts to the following in order to run both the client amp server in parallel scripts start server nodemon index js ignore client start client npm run serve prefix client dev concurrently npm run start server npm run start client After this connect the server to MongoDB through mongoose Mongoose provides a straightforward schema based solution to model your application data It includes built in type casting validation query building business logic hooks and more out of the box features Basic code for the hello world setup const mongoose require mongoose const PORT mongoUri require config const cors require cors require dotenv config app use cors to allow cross origin requestsapp use bodyParser json to convert the request into JSONmongoose connect process env MONGO URI useNewUrlParser true useUnifiedTopology true then gt console log MongoDB database Connected catch err gt console log err app listen process env PORT gt console log App listening at http localhost process env PORT Creating MongoDB User and Connecting to DatabaseMongoDB Atlas is a fully managed cloud database that handles all the complexity of deploying managing and healing the deployments on the cloud service provider of your choice AWS Azure and GCP Before running the server create a MongoDB database on the atlas instance by following these steps Step Head over to MongoDB atlas and sign in with your account Step Click on New ProjectMongoDB new projectStep Give a name to the projectMongoDB create projectStep Click on Create Project MongoDB create a projectStep Now click on Build Database and select Free Tire and click on Create Cluster Step Give username and password here and click on Create User MongoDB creating userStep Scroll down and whitelist the localhost IP in order to be able to connect with MongoDB atlas Then click on Add Entry →Finish and Close MongoDB whiltelisting IPStep Now click on Connect button MongoDB Connecting UserStep And then click on Choose your application and then copy the Mongo URLMongoDB generating URLStep In the server create a env file and add both MONGO URI amp PORTMONGO URI lt mongdb uri gt PORT Do not forget to replace password with the user password that you ve generated Start the server and check if everything is working fine by npm run devornpm run start server just to check the server Creating Todo Schema using MongooseCreate schema for the todo task using Mongoose Create a models folder in the root directory and Todo js file and use the following code to create a schema Creating todo schema const Schema model require mongoose const TodoSchema new Schema title type String required true description type String required true const Todo model todo TodoSchema module exports Todo Creating API RoutesCreate a file Todolist js under routes api and use the following code to create GET POST PUT amp DELETE endpoints to perform listing creating updating and deleting the tasks in the To Do list respectively API Endpoints const Router require express const Todo require models Todo const router Router router get async req res gt try const todoList await Todo find if todoList throw new Error No Todo List found res status json todoList catch error res status json message error message router post async req res gt const newTodo new Todo req body try const todo await newTodo save if todo throw new Error Something went wrong saving the Todo res status json todo catch error res status json message error message router delete id async req res gt const id req params try const removed await Todo findByIdAndDelete id if removed throw Error Something went wrong res status json removed catch error res status json message error message module exports routerImport the routes onto the index js file The final index js file looks something like this const express require express const app express const mongoose require mongoose const cors require cors const bodyParser require body parser const TodoListRoutes require routes api todoList const path require path require dotenv config app use cors app use bodyParser json mongoose connect process env MONGO URI useNewUrlParser true useUnifiedTopology true then gt console log MongoDB database Connected catch err gt console log err app use api todoList TodoListRoutes app listen process env PORT gt console log App listening at http localhost process env PORT Creating Client Application with VuejsGet into the client folder and generate a new application using vue create commandGenerating a new Vue application vue create clientSelect Vue and the default option while installing the application Vue create command Proxy API requests from the Vue appIn order to call the API we need to proxy the request from the frontend so that the request URL will be the server URL In vue config js make the following change const defineConfig require vue cli service module exports defineConfig transpileDependencies true configureWebpack devServer proxy api target http localhost To do the API requests install axios package npm i axiosRemove contents in src App vue and components folder we don t need components folder for this application and add the basic template as follows Basic Hello World template on App vue lt template gt lt div gt message lt div gt lt template gt lt script gt export default name App data return message Hello World lt script gt lt style gt lt style gt As we already setup concurrent running of both client and server we can directly check this on http localhost Hello World Vue AppIn App vue create the appropriate data object and methods to handle creating and deleting todos amp handle template and style Handling Vue LogicUnder the script tag import the Axios package Instantiate todos the title for a todo and description for a todo on the data function Under methods create functions to add and remove todo mounted function runs as soon as the component loads hence call GET todos in that function lt script gt import axios from axios export default name App data return todos description title async mounted const response await axios get api todoList this todos response data methods async addTodo e e preventDefault const response await axios post api todoList title this title description this description this todos push response data this title this description async removeTodo item i await axios delete api todoList item id this todos splice i lt script gt Create HTML for the application under template tag lt template gt lt div class main gt lt h gt Todo List lt h gt lt form class form gt lt input class input v model title type text name name placeholder Enter todo gt lt br gt lt input class input v model description type text name description placeholder Enter Description gt lt br gt lt button class submit button click addTodo gt Add Todo lt button gt lt form gt lt div class todo container gt lt ul gt lt li v for todo i in todos key todo id gt lt div class todo gt lt span class todo name gt todo title lt span gt lt span class todo description gt todo description lt span gt lt div gt lt button class delete btn click removeTodo todo i gt DELETE TODO lt button gt lt li gt lt ul gt lt div gt lt div gt lt template gt Styling the HTML lt style gt main margin auto margin top rem max width px form display flex flex direction column align items center h font size px font weight bold text align center input width padding px submit button width px padding px background color d color white cursor pointer todo container display flex flex direction column align items center todo container ul width list style none padding todo container ul li display flex flex direction row align items center justify content space between padding px border bottom px solid eee todo display flex flex direction column align items flex start justify content flex start padding px max width px todo name font size px font weight bold todo description max width font size px delete btn background color f color white padding px cursor pointer border none lt style gt Running the applicationRun the following command to start both client amp server npm run devNow the client should be running on http localhost http localhost while the server runs on http localhost ConclusionIn this tutorial we learned how to build a full stack MEVN application All the four technologies in MEVN stack MongoDB Express js Vue js and Node js are widely adopted popular technologies with a huge community So it s safe to build production ready applications with the MEVN stack As the entire stack uses Javascript it s easier for developers to collaborate Performance Monitoring of your MEVN appsOnce you build your application and deploy it to production monitoring it for performance issues becomes critical Mostly in today s digital ecosystem applications have distributed architecture with lots of components It gets difficult for engineering teams to monitor their app s performance across different components A full stack Application Performance Monitoring solution like SigNoz can help you monitor your MEVN applications for performance and troubleshooting In order to monitor your application you need to generate telemetry data out of it SigNoz uses OpenTelemetry an open source project aimed at creating an open standard for instrumentation to instrument applications for generating telemetry data SigNoz is open source so you can try it out directly from its GitHub repo Further Reading SigNoz an open source alternative to DataDog 2022-06-09 12:24:21
Apple AppleInsider - Frontpage News Apple issues rare AirPods developer beta firmware https://appleinsider.com/articles/22/06/09/apple-issues-rare-developer-beta-software-for-airpods?utm_medium=rss Apple issues rare AirPods developer beta firmwareApple has released an AirPods beta software update aimed at bug fixes and improvements to Automatic Switching Although Apple has released AirPods beta software before it s much rarer than such updates for iOS This one comes as iOS introduces personalized spatial audio but the release notes don t mention that Nonetheless the beta update is meant for iOS as developers have been told that to test it they must have Read more 2022-06-09 12:32:56
海外TECH Engadget Apple's AirTag is back down to a record low on Amazon https://www.engadget.com/apples-airtag-is-back-down-to-a-record-low-on-amazon-124020637.html?src=rss Apple x s AirTag is back down to a record low on AmazonWhile the four pack of AirTags has been on sale for some time now it s been a while since we ve seen one AirTag go on sale Now Amazon s brought back the record low price on a single pack so you can grab one AirTag for only That s off its normal price ーthat may not seem like much but it s a decent deal on an already affordable accessory Buy AirTag at Amazon Buy AirTags pack at Amazon If you re unfamiliar AirTags allow iPhone users to keep track of their things from within the Find My app Much like AirPods AirTags seamlessly pair with iPhones as soon as you take them out of the box and from there you can label what the tracker is attached to like your keys wallet or backpack A big downside to AirTags when compared to competing trackers like those from Tile is that Apple s devices don t have built in keyring holes That means you ll have to buy a case or holder if you want to attach it to your keys After a quick setup process you ll be able to check the Find My app whenever you need to locate your stuff AirTags can also emit a chime if you re nearby which should help you find your lost things a bit more easily And if you have one of the latest iPhones the Precision Finding feature can lead you directly to your stuff using on screen instructions Bluetooth trackers like these may not be as essential as your smartphone or even a smartwatch that you ve grown attached to but they will come in handy on the rare occasion that you misplace your belongings Follow EngadgetDeals on Twitter for the latest tech deals and buying advice 2022-06-09 12:40:20
海外科学 NYT > Science The New Abortion Bans: Almost No Exceptions for Rape, Incest or Health https://www.nytimes.com/2022/06/09/health/abortion-bans-rape-incest.html The New Abortion Bans Almost No Exceptions for Rape Incest or HealthMost of the state abortion prohibitions that would go into effect if Roe v Wade is overturned do not contain carve outs that were once widely supported by abortion opponents 2022-06-09 12:14:03
海外科学 All Top News -- ScienceDaily Europe's largest land predator unearthed on the Isle of Wight https://www.sciencedaily.com/releases/2022/06/220609082238.htm Europe x s largest land predator unearthed on the Isle of WightPalaeontologists have identified the remains of one of Europe s largest ever land based hunters a dinosaur that measured over m long and lived around million years ago 2022-06-09 12:22:38
ニュース BBC News - Home Prince William spotted selling Big Issue in central London https://www.bbc.co.uk/news/uk-england-london-61747092?at_medium=RSS&at_campaign=KARANGA cambridge 2022-06-09 12:49:35
ニュース BBC News - Home Storm Arwen: Get ready for more storm power cuts, energy firms told https://www.bbc.co.uk/news/uk-61742328?at_medium=RSS&at_campaign=KARANGA ofgem 2022-06-09 12:03:44
ニュース BBC News - Home Berlin crash: Attack on capital's streets was ‘cruel rampage’ – Scholz https://www.bbc.co.uk/news/world-europe-61742735?at_medium=RSS&at_campaign=KARANGA custody 2022-06-09 12:21:34
ニュース BBC News - Home Ms Marvel: Critics praise Disney's 'joyful' first Muslim superhero story https://www.bbc.co.uk/news/entertainment-arts-61743910?at_medium=RSS&at_campaign=KARANGA culture 2022-06-09 12:45:27
ニュース BBC News - Home England v New Zealand: Captain Ben Stokes bringing back the 'fun' https://www.bbc.co.uk/sport/cricket/61744740?at_medium=RSS&at_campaign=KARANGA england 2022-06-09 12:17:54
ニュース BBC News - Home Alexandre Lacazette: Arsenal forward re-signs for Lyon five years after leaving https://www.bbc.co.uk/sport/football/61675302?at_medium=RSS&at_campaign=KARANGA Alexandre Lacazette Arsenal forward re signs for Lyon five years after leavingArsenal forward Alexandre Lacazette re signs for Lyon on a free transfer five years after leaving to join the Gunners for a then club record £m 2022-06-09 12:49:38
ニュース BBC News - Home Landlady gives up pub as quarterly energy bills near £30,000 https://www.bbc.co.uk/news/business-61743920?at_medium=RSS&at_campaign=KARANGA businesses 2022-06-09 12:40:08
北海道 北海道新聞 冷凍食品の製造拠点整備へ 帯広のビゴラス 受託生産も 収益多角化狙う https://www.hokkaido-np.co.jp/article/691657/ 冷凍食品 2022-06-09 21:21:00
北海道 北海道新聞 ラワンブキ天高く 足寄で収穫スタート https://www.hokkaido-np.co.jp/article/691656/ 北海道遺産 2022-06-09 21:19:00
北海道 北海道新聞 鶴居中心部に温泉ホテル 釧路の阿部ビル11月開業 地ビール提供、日帰り入浴も https://www.hokkaido-np.co.jp/article/691655/ 地ビール 2022-06-09 21:16:00
北海道 北海道新聞 クレインズ苦境打開へ 10日からCF 目標200万円、遠征費や備品購入 https://www.hokkaido-np.co.jp/article/691654/ 遠征 2022-06-09 21:14:00
北海道 北海道新聞 防衛装備品協定、交渉入り合意へ 日シンガポール首脳 https://www.hokkaido-np.co.jp/article/691652/ 岸田文雄 2022-06-09 21:13:00
北海道 北海道新聞 日高管内4人感染 新型コロナ https://www.hokkaido-np.co.jp/article/691651/ 胆振管内 2022-06-09 21:10:00
北海道 北海道新聞 ロ2―0中(9日) ロメロ、好投で4勝目 https://www.hokkaido-np.co.jp/article/691650/ 連勝 2022-06-09 21:09:00
北海道 北海道新聞 「ねりこみ」感染対策で距離短縮 おたる潮まつり7月22~24日開催 神輿など取りやめ 最終日に3尺玉の大花火 https://www.hokkaido-np.co.jp/article/691649/ 実行委員会 2022-06-09 21:08:00
北海道 北海道新聞 山の水族館「飼育員の一日」動画作りに汗 改装10周年記念し7月公開予定 https://www.hokkaido-np.co.jp/article/691600/ 公開予定 2022-06-09 21:08:46
北海道 北海道新聞 後志管内27人感染 小樽市は22人 新型コロナ https://www.hokkaido-np.co.jp/article/691476/ 新型コロナウイルス 2022-06-09 21:05:58
北海道 北海道新聞 三室戸寺、夕闇にアジサイ淡く 京都、ライトアップ試験点灯 https://www.hokkaido-np.co.jp/article/691648/ 三室戸寺 2022-06-09 21:03:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)