投稿時間:2023-08-29 05:27:22 RSSフィード2023-08-29 05:00 分まとめ(30件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
AWS AWS Build SQL Scripts and Queries with Amazon CodeWhisperer | Amazon Web Services https://www.youtube.com/watch?v=ZtxjZYUnT9k Build SQL Scripts and Queries with Amazon CodeWhisperer Amazon Web ServicesIn this video you ll see how to build SQL scripts and queries with Amazon CodeWhisperer With this AI powered tool you can use code suggestions to increase your productivity complete complex SQL tasks and manage a variety of SQL based databases For more information on this topic please visit the resource s below Amazon CodeWhisperer AWS Toolkit for Visual Studio Code Subscribe More AWS videos More AWS events videos Do you have technical AWS questions Ask the community of experts on AWS re Post ABOUT AWSAmazon Web Services AWS is the world s most comprehensive and broadly adopted cloud platform offering over fully featured services from data centers globally Millions of customers ーincluding the fastest growing startups largest enterprises and leading government agencies ーare using AWS to lower costs become more agile and innovate faster AWS AmazonWebServices CloudComputing 2023-08-28 19:25:19
AWS AWS Build Shell Scripts with Amazon CodeWhisperer | Amazon Web Services https://www.youtube.com/watch?v=1Px6VWorCsc Build Shell Scripts with Amazon CodeWhisperer Amazon Web ServicesIn this video you ll see how to build shell scripts with Amazon CodeWhisperer With this AI powered tool you can use code suggestions to create shell scripts that automate tasks and secure your applications For more information on this topic please visit the resource s below Subscribe More AWS videos More AWS events videos Do you have technical AWS questions Ask the community of experts on AWS re Post ABOUT AWSAmazon Web Services AWS is the world s most comprehensive and broadly adopted cloud platform offering over fully featured services from data centers globally Millions of customers ーincluding the fastest growing startups largest enterprises and leading government agencies ーare using AWS to lower costs become more agile and innovate faster AWS AmazonWebServices CloudComputing 2023-08-28 19:25:16
AWS AWS Build an Apache Spark ETL Job using Amazon CodeWhisperer | Amazon Web Services https://www.youtube.com/watch?v=GbqKd2hWOm0 Build an Apache Spark ETL Job using Amazon CodeWhisperer Amazon Web ServicesIn this video you ll see how to build an Apache Spark ETL extract transform and load job using Amazon CodeWhisperer With CodeWhisperer you can generate ETL code in Python create and submit infrastructure resources using the AWS CLI and verify the results in Amazon Athena For more information on this topic please visit the resource s below Subscribe More AWS videos More AWS events videos Do you have technical AWS questions Ask the community of experts on AWS re Post ABOUT AWSAmazon Web Services AWS is the world s most comprehensive and broadly adopted cloud platform offering over fully featured services from data centers globally Millions of customers ーincluding the fastest growing startups largest enterprises and leading government agencies ーare using AWS to lower costs become more agile and innovate faster AWS AmazonWebServices CloudComputing 2023-08-28 19:24:30
AWS AWS Use CodeWhisperer with Amazon SageMaker Studio | Amazon Web Services https://www.youtube.com/watch?v=tEkRaKQmOKc Use CodeWhisperer with Amazon SageMaker Studio Amazon Web ServicesIn this video you will see how to use CodeWhisperer with Amazon SageMaker Studio With the CodeWhisperer AI coding companion you can efficiently prepare your datasets train and deploy machine learning models and monitor model performance For more information on this topic please visit the resource s below Subscribe More AWS videos More AWS events videos Do you have technical AWS questions Ask the community of experts on AWS re Post ABOUT AWSAmazon Web Services AWS is the world s most comprehensive and broadly adopted cloud platform offering over fully featured services from data centers globally Millions of customers ーincluding the fastest growing startups largest enterprises and leading government agencies ーare using AWS to lower costs become more agile and innovate faster AWS AmazonWebServices CloudComputing 2023-08-28 19:12:02
AWS AWS Develop Java Spring Boot Applications with Amazon CodeWhisperer | Amazon Web Services https://www.youtube.com/watch?v=F20--WxQvXU Develop Java Spring Boot Applications with Amazon CodeWhisperer Amazon Web ServicesIn this video you ll see how to develop Java Spring Boot applications with Amazon CodeWhisperer With this feature you can use code suggestions to accelerate software development allowing more time for other tasks such as ideation complex problem solving and writing differentiated code For more information on this topic please visit the resource s below Subscribe More AWS videos More AWS events videos Do you have technical AWS questions Ask the community of experts on AWS re Post ABOUT AWSAmazon Web Services AWS is the world s most comprehensive and broadly adopted cloud platform offering over fully featured services from data centers globally Millions of customers ーincluding the fastest growing startups largest enterprises and leading government agencies ーare using AWS to lower costs become more agile and innovate faster AWS AmazonWebServices CloudComputing 2023-08-28 19:11:58
AWS AWS AWS Skills Centers: Start your cloud journey with FREE instructor-led classes | Amazon Web Services https://www.youtube.com/watch?v=W3_Eor2y9qk AWS Skills Centers Start your cloud journey with FREE instructor led classes Amazon Web ServicesAWS Skills Centers are where the cloud curious can discover new career possibilities Explore interactive exhibits participate in live classes with AWS instructors and make connections at networking events It s all free and everyone is welcome Plan your visit and register for FREE instructor led classes Subscribe More AWS videos More AWS events videos Do you have technical AWS questions Ask the community of experts on AWS re Post ABOUT AWSAmazon Web Services AWS is the world s most comprehensive and broadly adopted cloud platform offering over fully featured services from data centers globally Millions of customers ーincluding the fastest growing startups largest enterprises and leading government agencies ーare using AWS to lower costs become more agile and innovate faster AWS AmazonWebServices CloudComputing 2023-08-28 19:11:51
AWS AWS Start your cloud journey at AWS Skills Center Cape Town | Amazon Web Services https://www.youtube.com/watch?v=ZOYQiiACvBo Start your cloud journey at AWS Skills Center Cape Town Amazon Web ServicesAWS Skills Centers are where the cloud curious can discover new career possibilities Explore interactive exhibits participate in live classes with AWS instructors and make connections at networking events It s all free and everyone is welcome Plan your visit and register for FREE instructor led classes Subscribe More AWS videos More AWS events videos Do you have technical AWS questions Ask the community of experts on AWS re Post ABOUT AWSAmazon Web Services AWS is the world s most comprehensive and broadly adopted cloud platform offering over fully featured services from data centers globally Millions of customers ーincluding the fastest growing startups largest enterprises and leading government agencies ーare using AWS to lower costs become more agile and innovate faster AWS AmazonWebServices CloudComputing 2023-08-28 19:11:47
海外TECH DEV Community I love negative comments! https://dev.to/apetryla/i-love-negative-comments-ohp I love negative comments Sometimes I fear to say something Sometimes I doubt if my comment doesn t look funny Sometimes I feel weird for having a different opinion Sometimes I feel silly for doing something I want These feelings are meaningless Growth happens not by crossing the finish line but by falling and trying to get back up 2023-08-28 19:21:24
海外TECH DEV Community Entendendo JOINs no SQL: Unindo Tabelas Como um Profissional https://dev.to/rafaelarc/entendendo-joins-no-sql-unindo-tabelas-como-um-profissional-260d Entendendo JOINs no SQL Unindo Tabelas Como um ProfissionalOláa todos Hoje vamos mergulhar em um dos aspectos mais fundamentais do SQL os JOINs Os JOINs são usados para combinar linhas de duas ou mais tabelas baseadas em uma relação lógica entre elas Primeiro vamos falar sobre o INNER JOIN Este tipo de JOIN retorna registros com valores correspondentes em ambas as tabelas Vejamos um exemplo SELECT Alunos Nome Cursos NomeCurso FROM Alunos INNER JOIN Cursos ON Alunos CursoID Cursos ID No exemplo acima estamos combinando as tabelas Alunos e Cursos retornando somente os alunos que estão inscritos em um curso O próximo éo LEFT JOIN Este JOIN retorna todos os registros da tabela àesquerda a primeira tabela e os registros correspondentes da tabela àdireita a segunda tabela Se não houver correspondência o resultado éNULL do lado direito Exemplo SELECT Alunos Nome Cursos NomeCurso FROM Alunos LEFT JOIN Cursos ON Alunos CursoID Cursos ID Neste exemplo obteremos todos os alunos estejam eles inscritos em um curso ou não O RIGHT JOIN éo oposto do LEFT JOIN retornando todos os registros da tabela àdireita e os registros correspondentes da tabela àesquerda Se não houver correspondência o resultado éNULL do lado esquerdo Por fim temos o FULL JOIN Este tipo de JOIN retorna todos os registros quando háuma correspondência na tabela àesquerda primeira tabela ou na tabela àdireita segunda tabela SELECT Alunos Nome Cursos NomeCurso FROM Alunos FULL JOIN Cursos ON Alunos CursoID Cursos ID Neste caso obteremos todos os alunos e todos os cursos estejam os alunos inscritos ou não em um curso Removendo valores nulosPor fim vamos lidar com valores NULL nas consultas Ao executar JOINs especialmente LEFT RIGHT e FULL JOINs vocêpode se deparar com valores NULL nos resultados onde não hácorrespondência No SQL podemos usar a função IS NULL para testar se um campo éNULL e a função IS NOT NULL para testar se um campo não éNULL Por exemplo para encontrar todos os alunos que estão inscritos em um curso vocêpoderia escrever SELECT Alunos Nome Cursos NomeCurso FROM Alunos LEFT JOIN Cursos ON Alunos CursoID Cursos IDWHERE Cursos NomeCurso IS NOT NULL Neste caso estamos excluindo todas as linhas onde NomeCurso éNULL ou seja onde o aluno não estáinscrito em nenhum curso Além disso o SQL oferece a função COALESCE que retorna o primeiro valor não nulo em uma lista de expressões Por exemplo vocêpoderia substituir valores NULL por uma string como Não inscrito da seguinte forma SELECT Alunos Nome COALESCE Cursos NomeCurso Não inscrito FROM Alunos LEFT JOIN Cursos ON Alunos CursoID Cursos ID Neste caso qualquer aluno que não esteja inscrito em um curso terá Não inscrito no campo NomeCurso em vez de NULL Tratar corretamente os valores NULL éessencial para manter a integridade e a precisão dos seus resultados por isso certifique se de levar em conta ao realizar suas consultas SQL Espero que este artigo tenha lhe dado uma melhor compreensão de como os JOINs funcionam no SQL e como lidar com valores NULL Lembre se a prática leva àperfeição então continue explorando e experimentando 2023-08-28 19:14:47
海外TECH DEV Community Next x Nest - Connecting your NextJs App to a NestJs Backend https://dev.to/abhikbanerjee99/next-x-nest-connecting-your-nextjs-app-to-a-nestjs-backend-419c Next x Nest Connecting your NextJs App to a NestJs BackendAs a Fullstack dev there are plenty of times when you d be involved in the creation of the backend while also helping out in the frontend As a Web dev that s especially true since most frontend developers might know of react query swr and axios but not of ethersjs and viem So it tends to become a habit of sorts to help on the front end side Quite recently our company has been considering NestJs as a candidate for the backend stack Having used it before it s really a no brainer as to why someone would not want to utilize NestJs There are other alternatives but when compared to barebones from scratch development using Express I would always prefer a framework like Nest It helps focus the development strategies while staying true to the underlying library be it fastify or express In short it helps avoid chaos In my recent series I have explored the usage of NextJS But those were particularly Web focused All things considered it seemed like a next step to explore how to use NextJS with Next Auth and combine that with a NestJS backend So what to build amp what would be the objectives But as with every series a mini project is needed Seeing how creating a “Kanban Board App is all the rage right now amongst frontend devs on Youtube using DND Kit I thought why not give it a try ourselves So we will create an end to end sort of project in this series A personal Kanban Board with NestJS in the backend NextJs in the frontend Next Auth handling the authentication on the frontend Supabase for Auth DB on both ends NoSQL DB for the backendThe objectives here would be to answer the following questions through the mini project How to use NextAuth with Next Js and a Custom Backend How to configure Next Auth s Google Provider to work with a custom Backend How to manage Authentication and Authorization when using Next Auth with Google or a similar provider and a custom Backend Can the Access Token and ID tokens from Next Auth providers be utilized with NestJS How to manage authentication on REST with a GraphQL backend in NestJs Can multiple Prisma providers be used in a single NestJS backend If so then how We won t be answering all the questions outright in this article In fact along the way there might be more questions added to the list Rest assured these questions will be answered by the time we reach the end of the series In this article we will focus on how to use Next Auth with NextJs and make it talk securely with the NestJs Backend Things become easier if we use CredentialsProviders of Next Auth If used with a NestJs Backend one needs to utilize the authorize method Once the user enters the credentials on the frontend this callback is invoked The authorize callback will send the credentials to the NestJs backend s API The NestJS Backend Auth API will receive the credentials username and password or something similar and if the user exists will send back an access token JWT or something Back in the authorize callback when the access token is received that will be included in the User s session in the Next Auth through the session callback Simple as that Things become a bit complicated with Next and Next Auth if you take into account Providers like Google Gitlab Github and so on These providers send back access token and other similar tokens to next auth and are tied tightly to work seamlessly with NextJs and optionally a DB The USP of NextJS being a Fullstack framework aiming to provide completeness out of the box also becomes a burden on some Devs trying to customize things to suit the use case What many devs fail to realize is that Next Auth through these providers is supposed to provide Authentication authN The Authorization authZ part of management still rests with us It Must be configured by us Say if the Google Provider provides access token and id token should these be used for authZ No One should create their own methods of authZ This can range from simple second JWTs in the session to LDAP But where to insert this mechanism How do we insert it so that it can also function with a custom backend One cannot simply leave the backend open to all requests AuthN and AuthZ is needed there as well With these questions in mind let s get started with this series HousekeepingBefore we jump right into coding there are some steps we need to take This tutorial assumes basic familiarity with NestJS and NextJS Knowledge of next auth is a plus but not mandatory We would also need to use Supabase and Prisma So the reader should be familiar with the basics there as well Setting up SupabaseJust head over to supabase com and signup if you haven t already Create a new project under the organization of your choice In my case I have selected the default org called abhik The project I have created is called “Next Fullstack as shown in the image below The image below shows the Supabase Dashboard after creating the project We will use the Next Auth quickstarts to get up and running fast Click on your project then click on the “SQL Editor icon from the left panel Head over to “Quickstarts as shown below After that click on “Next Auth Schema Setup option as marked below As shown in the image below this will open the SQL Editor with the Statements to run Click on Run to execute those SQL statements Supabase will run those and create your tables for you The schema name would be next auth You might be tempted to think that this is it But this is just half the process Our schema is created But by default it is created as a private schema So while we can manipulate it from Supabase Dashboard we will not be able to connect to the Supabase instance and query it To make sure that the schema we created can be accessed using something like Prisma we need to make it public To make sure that queries can be run we need to tell Supabase to insert a search path for the schema These two are separate steps which we will cover next As shown in the image above to make our custom Supabase Schema accessible and query able we need to go to Settings After this click on API This option will show you the essentials like the Service role key anon key and more Scroll down to the API Settings Here we need to add our custom schema which in our case is next auth This needs to be followed up with adding the same schema to the Extra Search Path option Click on Save to make sure these changes take effect This completes our Supabase setup Next we will move to setting up our NextJs and NestJs projects inside a mono repo Setting up NextxNest ProjectTypically one would first initialize the monorepo first and then add the required projects But we won t follow the general script of steps here We will first set up our sub projects and then create a monorepo out of it all This roundabout way of doing things will help answer the question “How do we create a Monorepo from an existing project We will use Turborepo to handle the monorepo part of things and use NPM as the package manager Initializing NextJSSetting up NextJs is really simple All you need to run is npx create next app latest This will install create next app if you don t have it already and then direct you through a series of questions In our case albeit the project name everything else will be set to the default setting We will call our NextJS project “frontend Following the prompts from the script you should have a folder called frontend This will be where we create unsurprisingly the frontend for our Kanban project Integrating Next Auth and Supabase into NextJS will be covered in the later sections Initializing NestJSThe more convenient way of using NestJs is to install the NestJS CLI globally and use it again and again to create new projects controllers sub apps and microservices Running npm I g nestjs cli will do precisely that for you Assuming you have already done that move to the parent folder of frontend and run nest new backend If you get an error that the nest script cannot be found or something even after installing Nest CLI try running npx nest new backend to see if it works This will create a Nest project called backend at the same level as our Next project called frontend Make sure to remove the node modules folders from both Furthermore move to the package json inside backend NestJS project and rename the script start dev to just dev This will match the NestJs dev script with the dev script name in the NextJS project Additionally find the main ts file of your Nest project and change the PORT from the default to This will prevent a port collision between the NextJS project and our backend Creating a MonorepoLastly we will create a Turborepo monorepo out of an already existing project In the folder containing backend and frontend run npm init This will create the package json we need Once you have the package json we need to add turbo dependencies and the scripts along with denoting the workspaces Create a folder called apps and move the backend and frontend folders inside it The apps folder is our workspace The complete package json will look something similar to the script below name your jira version description An end to end mini project which explores using NextJs Next Auth on the frontend and NestJs backend by making a lightweight Kanban board called Your Jira workspaces apps keywords nest next turborepo next auth supabase author Abhik Banerjee packageManager npm devDependencies eslint prettier tsconfig turbo latest scripts build turbo run build dev turbo run dev lint turbo run lint format prettier write ts tsx md license ISC Next we need to create a Turbo script This is done by creating a turbo json file This file contains the build lint test and dev instructions A simple turbo json file might look like the script below You may copy the turbo json file below The pipeline property is where we specify the instructions for build lint and test tasks It also contains the instructions for running the project in Dev mode In our case we tell Turbo to not cache anything and every time something changes rerun the script and refresh schema globalDependencies env local pipeline build dependsOn build lint dev cache false persistent true After all these steps you may lastly add a gitignore file You can run npm i to install your dependencies globally Following this running npm run dev will start the dev server for both your backend and frontend simultaneously Your directory structure should look something similar to the image given below Note Normally you d have just one root tsconfig json and have the individual apps inherit from this by the extends keyword But I am choosing to be liberal here So we are going to have two separate tsconfig json in this project for now You may change that if you want Adding Next Auth and Supabase to NextNow we move on to the first part of the integration In this section we will integrate Supabase with NextJS and use Next Auth for Authentication You might be thinking “Well where does NestJs fit into all of this It doesn t All will be cleared as we go Adding Environment Variables to NextJsNormally you d do something like just add a env file and be done with it But that s not how we do things If you have been following my previous articles you d know by now a better way to add Environment variables to Next First head over to the root of the NextJS project In our case that is the root of the frontend folder not the app folder mind you Next create a file called additional env d ts This is where we will define the types of our environment variables In our case the file would look something similar to the Code file given below The code file below contains all the env variables needed for this part of things declare global namespace NodeJS interface ProcessEnv NODE ENV development production NEXTAUTH SECRET string Session Secret APP JWT SECRET string Authorization Token secret NEXTAUTH URL string GOOGLE CLIENT ID string GOOGLE CLIENT SECRET string NEXT PUBLIC SUPABASE URL string SUPABASE SERVICE ROLE KEY string If this file has no import export statements i e is a script convert it into a module by adding an empty export statement export Add this file to be picked up by the TS server in this project To do this head over to the tsconfig json of the frontend app and in the include array add the name of this file Lastly create a env at the same level and add the variable names to it The values for NEXT PUBLIC SUPABASE URL and SUPABASE SERVICE ROLE KEY can be obtained from the Supabase Settings Head over to the API section in settings as shown in the Supabase section above and you will the respective values in the “Project URL and “Project API Keys section as shown below The remaining values will be discussed below Google Client CredentialsFor using Google Sign in we will need Google API keys These API keys will be used by the GoogleProvider of Next Auth For these values head over to the Credentials section of “API amp Services as shown below After this click on Create Credentials as shown below Then select OAuth client ID In the next screen you will need to select the Application Type as “Web Application This will prompt you for a name for the App In our case I have named it “Your Jira pretty presumptuous The Authorized Javascript Origins records the URLs from where the OAuth requests can originate In our mini project the Sign in requests can independently originate from the frontend and backend running on localhost and localhost respectively So we will need to add them both Authorized redirect URIs represent the locations where the user will be redirected to after the user selects which Google account to sign in from Again this will need to be URIs one for frontend and another for backend Clicking on Create will create the OAuth Client and give you the client IDs as shown below In the image below you will see client secrets That s because I have purposefully generated two different client secrets But you can work with just one This will be the GOOGLE CLIENT SECRET You will get the client ID in the first screen in this subsection after you create your OAuth This will serve as the value for our GOOGLE CLIENT ID With this we have the Google bit of things with us Integrating Next AuthAll this time it has been just setup and setup And now more so To get started with integrating Next Auth into our Next JS app head over to the frontend repo Create a folder called api Inside this create another folder called auth Finally create a folder called …nextauth the name is really important here Inside this folder create a file called route ts The directory structure should look something similar to the image shown below do not pay attention to other folders starting with we will get to them Basically we are defining a backend API route auth which Next Auth will handle The route controllers are defined inside the route ts file and will look something similar to the code below In the code below we build the core of the NextJS Authentication system In line below we start to define our Next Auth handler Inside the providers array is where we keep all our authentication providers This shouldn t be anything new if you have been following my past articles The difference here is that instead of using CredentialsProvider as we have up till now we are now using the GoogleProvider Inside the GoogleProvider constructor it s mostly the default options We are passing in our GOOGLE CLIENT ID and GOOGLE CLIENT SECRET which we obtained from the section above We also tell the provider that we want a prompt for consent of the user everytime and we want the offline mode of authentication This will make sure that we get a refresh token import signJwt from app lib jwt import SupabaseAdapter from auth supabase adapter import Adapter from next auth adapters import NextAuth from next auth next import GoogleProvider from next auth providers google const handler NextAuth providers GoogleProvider clientId process env GOOGLE CLIENT ID clientSecret process env GOOGLE CLIENT SECRET authorization params prompt consent access type offline response type code session strategy jwt adapter SupabaseAdapter url process env NEXT PUBLIC SUPABASE URL secret process env SUPABASE SERVICE ROLE KEY as Adapter callbacks async jwt token account if account token auth token await signJwt sub token sub id token account id token access token account access token expires at account expires at return token async session session token session auth token token auth token as string return session export handler as GET handler as POST Now we need to explicitly set strategy to JWT here Because we are using a DB in the form of Supabase Next Auth will by default use the session strategy But in our mini project we are going to use JWTs We set the Supabase Adapter options at line Mostly default options here PS If you haven t already run npm i auth supabase adapter The callbacks part is crucial Normally Next Auth and NextJS work seamlessly to manage sessions This also includes encryption and decryption of session JWTs But we want to use another custom JWT This is where the jwt callback comes in This callback is invoked whenever JWT creation or updation is needed Since we are using the jwt strategy this callback will be invoked time and again This callback receives the decrypted Next Auth JWT token During Sign in this callback also receives another parameter called account which contains the details sent back by the provider In our case GoogleProvider will send back the id token access token and expires at which we will use to create our own custom JWT token using the signJwt method This custom encrypted JWT will be attached to the token through the auth token property The Next Auth Token comes from the jwt callback to the session callback In the session callback we will once again need to add the auth token property taken from token into the session object This will make sure that whenever we access the session on the frontend after sign in we get the custom JWT token This is how we should customize Next Auth when using it with Third Party providers like GitlabProvider GithubProvider and in our case GoogleProvider This custom JWT token will be used as an authorization token Basically this authZ token is our way of interacting with the NestJs backend while the access token and id token acts as the authN token and tells us we are interacting with a valid Google User The code below is what we keep inside a separate jwt folder inside the lib folder import jwt from jsonwebtoken export const signJwt async payload any expiresIn d gt const token await jwt sign payload process env APP JWT SECRET algorithm HS expiresIn return token export const verifyJwt token string gt const data jwt verify token process env APP JWT SECRET algorithms HS return data As you can see the above code is just a wrapper around JWT creation The APP JWT SECRET serves as the secret key for our custom JWT This secret needs to match the JWT secret on the Nest backend end for the whole thing to seamlessly work Lastly create a types folder and inside it create a next auth d ts file Paste the following code inside it This piece of code tells Next Auth that in addition to whatever Next Auth is sending inside the session of a signed in user we want to include our custom property called auth token which will hold our authZ JWT token import NextAuth from next auth declare module next auth interface Session extends Session auth token string With this we have fully integrated Next Auth with Google OAuth Provider into our NextJS project and customized it to interact with a custom NestJS backend Adding an AuthContext Appbar and Sign In buttonFirstly to use Next Auth client side we need to wrap our app in a Context Luckily Next Auth provides us with that out of the box We will follow the convention we have been using thus far in my articles and create a providers folder which will contain all the providers keep in mind the files inside this folder will have tsx extension since they will be used on the frontend side The Root provider will then be wrapped around the root layout layout tsx file at the root of the app folder inside frontend The image below shows the intended code Next create a components folder and create a SignoutButton tsx component We will make this a client component It will handle the authentication flow from the client side Inside the component we import the useSession hook from Next Auth as shown below This hook will provide the session data The session object renamed from the data property destructured from the returns of the hook will contain a user property use client import signIn signOut useSession from next auth react import React from react const SignoutButton gt const data session useSession if session user return lt div className flex gap ml auto gt lt p className text sm tracking tight text sky gt session user name lt p gt lt button onClick gt signOut gt Sign Out lt button gt lt div gt return lt button onClick gt signIn gt Sign in lt button gt export default SignoutButton This user property will contain the session details Thanks to all the changes we did in the previous subsection this user property will contain also the auth token which can be used to interact with the Nest Backend The absence of this user property will tell us that the user has not authenticated We will display “Sign In if so Otherwise we will display “Sign Out NOTE you have used multiple providers for authN and you would like to customize the Sign In page then in the signOut and signIn functions you would need to also provide the ID of the providers But here we will use the Sign In page provided automatically by Next Auth So we do not need to pass anything to these functions After this we need to create a simple Appbar For this create a component called Appbar tsx inside the components folder As shown in the code section below it will be a server component Since we are not using any hooks or client side interaction we can limit the interactivity provided by client components to the SignoutButton component only import React from react import SignoutButton from SignoutButton const Appbar gt return lt header className flex justify end gap p bg gradient to b from blue to black shadow gt lt SignoutButton gt lt header gt export default Appbar Lastly add the above Appbar component to the root layout tsx like done below and that s it We have completed our integration of Next Auth and Supabase into NextJS app In the next section we will just test out the functionality developed thus far import globals css import type Metadata from next import Inter from next font google import Providers from providers Provders import Appbar from components Appbar const inter Inter subsets latin export const metadata Metadata title Create Next App description Generated by create next app export default function RootLayout children children React ReactNode return lt html lang en gt lt body className inter className gt lt Providers gt lt Appbar gt children lt Providers gt lt body gt lt html gt Testing out FrontendThe frontend NextJs app will interact with the Supabase instance that we have previously provisioned through Next Auth Next Auth will use Google OAuth through the GoogleProvider and the client credentials we picked up from the Google Cloud Console To run our apps just run npm run dev and Turbo will take care of the rest Our backend and frontend will start parallelly If the user signing in is a new user then a new entry is created in Supabase in the users table Along with this another related record is created in the accounts table The former is for storing your user profiles while the latter stores all the providers that the users in your users table have used to sign in The real magic of the accounts table becomes clear when using multiple OAuth providers But here for the sake of simplicity we will just use Google OAuth ConclusionThis concludes the first article in the series While I wanted to complete the integration Passport and NestJS and show a working demo I realize that the article has become too long For this reason I will conclude this article here abruptly and in the next article we will cover the NestJS Passport Supabase part and use the auth token JWT from frontend to interact with the backend Until next time take care and continue to build awesome things 2023-08-28 19:11:30
海外TECH DEV Community Programming 101: The Keys to Mastering Any Programming Language https://dev.to/davidevlops/programming-101-the-keys-to-mastering-any-programming-language-4k0m Programming The Keys to Mastering Any Programming LanguageThroughout my years as a software developer I ve written programs in various programming languages During this journey I ve encountered certain fundamental concepts that remain consistent across all these languages In this blog I ll be exploring essential concepts that every programmer should grasp regardless of the programming language they work with PrerequisitesTo write software programs in any programming language you ll require the following essential prerequisites Text editor A software application designed for creating and editing text files Text editors tailored for programming offer syntax highlighting and auto completion features to facilitate coding Popular choices include Notepad Atom Sublime Text and Visual Studio Code Compiler This program translates source code written in a programming language into machine code usually in s and s which the computer can directly execute It reads your source code and generates a file containing the machine code for your program which can be run on the computer Interpreter An interpreter directly executes the source code without the need for a compilation step This means you can run your program immediately after writing it without compiling it first However interpreters can be slower than compilers and might only support some programming languages These prerequisites collectively form the programming environment providing the necessary tools and resources to write and execute programs Remember that the specific environment can vary depending on the programming language used for instance the environment for C differs from that of Python Understanding Programming and Programming LanguagesProgramming is the art of providing instructions typically in a computer readable language to execute specific tasks A programming language serves as a means of communication with the computer While each language may have its unique syntax and features Basic Concepts Common in all programming languages Fundamental concepts are shared among all programming languages Some of these concepts include variable declaration syntax data types control flows conditionals and loops functions Object Oriented Programming and debugging Mastery of these core concepts empowers programmers to harness the capabilities of any programming language effectively Variable Declaration In computer programming a variable declaration is a statement that defines a variable A variable is a named location in memory that can store a value The variable declaration specifies the variable s name the variable s data type and the variable s initial value The syntax for a variable declaration varies in different programming languages Data TypesIn computer programming a data type is a classification of data that tells the compiler or interpreter how the programmer intends to use the data Most programming languages support various types of data including integer character or string and boolean Control FlowIn computer programming control flow refers to the order in which the statements in a program are executed Control flow statements are used to alter the order of execution such as by repeating a block of code or branching to a different part of the program There are two main types of control flow statements loops and conditionals Loops serve the purpose of repeating a block of code either for a specific number of iterations or until a particular condition is satisfied This repetition process is commonly referred to as iteration There are two primary types of loops the for loop used for a predetermined number of iterations and the while loop employed to continue until a given condition holds Conditionals are vital for controlling a program s flow based on specific conditions There are two primary types of conditionals the if statement which enables branching based on the truth of a condition and the switch statement which facilitates selecting different paths in the program based on the value of a variable FunctionsFunctions serve as essential building blocks in code encapsulating a clear and reusable set of instructions for accomplishing specific tasks efficiently As self contained units functions can accept input parameters arguments process them and generate meaningful output results To define a function programmers must indicate its name any necessary input parameters and the code block containing the sequence of operations to execute Importantly not all functions require input parameters some can operate based solely on their internal logic or access global variables Object Oriented Programming OOP Object Oriented Programming OOP is a programming paradigm that revolves around the concept of objects which are instances of classes It is a powerful and widely used approach to software development that aims to organize code in a way that models real world entities and their interactions DebuggingDebugging is very important for every programmer because every programmer makes mistakes when writing code Debugging is the process of identifying and resolving errors or defects in a software program It is an essential skill that involves locating and fixing issues that cause the program to behave unexpectedly or crash Debugging involves processes such as Identifying Bugs Locating the Cause Using Debugging Tools Fixing the Bug and Testing ConclusionIrrespective of the programming language one employs These fundamental principles play a pivotal role in shaping effective and efficient code By grasping these essential concepts programmers can enhance their problem solving skills promote code reusability and confidently navigate various programming languages Remember mastering these basics serves as a solid stepping stone toward becoming a proficient and versatile programmer capable of tackling diverse challenges in the dynamic world of software development 2023-08-28 19:10:53
Apple AppleInsider - Frontpage News Lifetime access to Windows 11 Pro is on sale for $32.97 (83% off) https://appleinsider.com/articles/23/07/06/lifetime-access-to-windows-11-professional-is-now-84-off-dropping-the-price-to-2997?utm_medium=rss Lifetime access to Windows Pro is on sale for off Windows Professional is now available at a whopping discount bringing the price down to From an intuitive interface to powerful multitasking tools Windows users can save a bundle on Win Pro Get Windows Pro for Windows updated features Read more 2023-08-28 19:27:25
ニュース BBC News - Home Airlines warn of UK flight delays over air traffic control fault https://www.bbc.co.uk/news/uk-66637156?at_medium=RSS&at_campaign=KARANGA major 2023-08-28 19:46:13
ビジネス ダイヤモンド・オンライン - 新着記事 発電時の「CO2排出量見える化」ビジネスの勝算、元東電マンの気鋭ベンチャーが構想 - エネルギー動乱 https://diamond.jp/articles/-/328178 二酸化炭素 2023-08-29 04:55:00
ビジネス ダイヤモンド・オンライン - 新着記事 米国のすしブーム、立役者はスーパー - WSJ PickUp https://diamond.jp/articles/-/328328 食品スーパー 2023-08-29 04:50:00
ビジネス ダイヤモンド・オンライン - 新着記事 【神戸女学院高等学部】華麗なる卒業生人脈!大橋未歩、宇宙飛行士候補の米田あゆ、塩野義製薬副会長の沢田拓子… - 日本を動かす名門高校人脈 https://diamond.jp/articles/-/328268 【神戸女学院高等学部】華麗なる卒業生人脈大橋未歩、宇宙飛行士候補の米田あゆ、塩野義製薬副会長の沢田拓子…日本を動かす名門高校人脈六甲の山々を背にした兵庫県西宮市の岡田山と呼ばれる小高い丘の上に、中学から大学院までの神戸女学院のキャンパスが広がっている。 2023-08-29 04:45:00
ビジネス ダイヤモンド・オンライン - 新着記事 偽パルメザンチーズ対策、チップを埋め込め - WSJ PickUp https://diamond.jp/articles/-/328327 wsjpickup 2023-08-29 04:40:00
ビジネス ダイヤモンド・オンライン - 新着記事 FRB利上げ終了か パウエル発言は選択肢残すが - WSJ PickUp https://diamond.jp/articles/-/328326 wsjpickup 2023-08-29 04:35:00
ビジネス ダイヤモンド・オンライン - 新着記事 少数株主の存在は会社運営上の大きなリスクになる! - 分散株式の集約で経営権を確保する方法 https://diamond.jp/articles/-/327334 少数株主 2023-08-29 04:30:00
ビジネス ダイヤモンド・オンライン - 新着記事 【OBサミットの真実】 福田赳夫が提唱、首脳経験者らによる国際的会議体 - OBサミットの真実 https://diamond.jp/articles/-/327453 2023-08-29 04:27:00
ビジネス ダイヤモンド・オンライン - 新着記事 【一発で理解できる】高校数学の超難所「微分」ってどういうこと? - 【フルカラー図解】高校数学の基礎が150分でわかる本 https://diamond.jp/articles/-/328309 本記事でははじめての人から大人の学び直しまで人で高校数学が学べる本として発刊された本書より内容の一部を抜粋してお届けします。 2023-08-29 04:24:00
ビジネス ダイヤモンド・オンライン - 新着記事 【超名門国立大】京都大学の学生にリアルな就活事情について話を聞いてみた - 大学図鑑!2024 有名大学82校のすべてがわかる! https://diamond.jp/articles/-/328307 2023-08-29 04:21:00
ビジネス ダイヤモンド・オンライン - 新着記事 職場にいる「まわりのモチベーションを上げられる人」と「まわりのやる気を削いでしまう人」の決定的な差とは - 1秒で答えをつくる力 お笑い芸人が学ぶ「切り返し」のプロになる48の技術 https://diamond.jp/articles/-/328308 2023-08-29 04:18:00
ビジネス ダイヤモンド・オンライン - 新着記事 【精神科医が教える】 毎日同じことの繰り返し…マンネリ化した毎日を楽しむ方法・ベスト1 - 精神科医Tomyが教える 40代を後悔せず生きる言葉 https://diamond.jp/articles/-/324256 【精神科医が教える】毎日同じことの繰り返し…マンネリ化した毎日を楽しむ方法・ベスト精神科医Tomyが教える代を後悔せず生きる言葉【大好評シリーズ万部突破】誰しも悩みや不安は尽きない。 2023-08-29 04:15:00
ビジネス ダイヤモンド・オンライン - 新着記事 20代女子が株式投資を知って衝撃!「働く以外にも、お金を稼ぐ方法があった♡」 - 女子株 https://diamond.jp/articles/-/327710 株式投資 2023-08-29 04:12:00
ビジネス ダイヤモンド・オンライン - 新着記事 直木賞作家が初めて読んだ歴史小説に学んだこと - 教養としての歴史小説 https://diamond.jp/articles/-/327459 直木賞作家が初めて読んだ歴史小説に学んだこと教養としての歴史小説歴史小説の主人公は、過去の歴史を案内してくれる水先案内人のようなもの。 2023-08-29 04:09:00
ビジネス ダイヤモンド・オンライン - 新着記事 【神様が味方する人の考え方】 「つらく、悲しく、苦しいこと」がどうしても人生に必要な理由 - ありがとうの奇跡――神様・人・モノが味方になる習慣 https://diamond.jp/articles/-/327943 【神様が味方する人の考え方】「つらく、悲しく、苦しいこと」がどうしても人生に必要な理由ありがとうの奇跡ー神様・人・モノが味方になる習慣年の発売以降、今でも多くの人に読まれ続けている『ありがとうの奇跡』。 2023-08-29 04:06:00
ビジネス ダイヤモンド・オンライン - 新着記事 【優秀な人の共通点】子どもの頃、誰に勉強を教えてもらったか? - 世界標準の子育て https://diamond.jp/articles/-/327612 【優秀な人の共通点】子どもの頃、誰に勉強を教えてもらったか世界標準の子育て子どもたちが生きる数十年後は、いったいどんな未来になっているのでしょうか。 2023-08-29 04:03:00
ビジネス 東洋経済オンライン 「誰でも論理的に話せる」東大生実践の凄い話術 聞き手の納得感がぐんと高まる話し方のコツ | 生まれつきの才能は不要 東大「逆転合格」の作法 | 東洋経済オンライン https://toyokeizai.net/articles/-/697622?utm_source=rss&utm_medium=http&utm_campaign=link_back 東洋経済オンライン 2023-08-29 04:50:00
ビジネス 東洋経済オンライン 異形の鉄道「スカイレール」なぜ2024年春に廃止? わずか1.3kmで160m勾配、一見ロープウェー | ローカル線・公共交通 | 東洋経済オンライン https://toyokeizai.net/articles/-/696688?utm_source=rss&utm_medium=http&utm_campaign=link_back 八本松駅 2023-08-29 04:30: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件)