TECH |
Engadget Japanese |
ロシア政府、アップルなどIT大手に現地オフィスや検閲協力を要求。従わない場合追放の恐れ |
https://japanese.engadget.com/russia-demand-tech-companies-open-loca-offices-113007288.html
|
開設 |
2021-11-25 11:30:07 |
TECH |
Engadget Japanese |
Virgin Galactic、宇宙旅行ペアチケット当選者をブランソン氏がサプライズ訪問 |
https://japanese.engadget.com/virgin-galactic-announce-winner-of-space-travel-110332321.html
|
spaceshiptwo |
2021-11-25 11:03:32 |
IT |
ITmedia 総合記事一覧 |
[ITmedia News] 巨大な球形ディスプレイ「ジオ・コスモス」の内部を初公開 日本科学未来館が27日から |
https://www.itmedia.co.jp/news/articles/2111/25/news184.html
|
itmedia |
2021-11-25 20:49:00 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
自然言語処理100本ノック2020を解いてみた(第一章) |
https://qiita.com/Panda2000/items/5f5c20cf920d257dafd3
|
自然言語処理本ノックを解いてみた第一章はじめに自然言語処理本ノックの第一章を解いてみました。 |
2021-11-25 20:29:52 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
変数とは何か、わかりやすく解説してみた【OBGノウハウ】 |
https://qiita.com/kana_mura/items/74799b052b79ae88257a
|
変数とは何か、わかりやすく解説してみた【OBGノウハウ】どのプログラミング言語を学んでいる上でも絶対必要となる知識がいくつかあると思うのですが、今回は初歩の初歩変数について私なりの解釈と講習会で使用している説明でのたとえ話なんかをまとめてみましたRPAツールやpythonやjs……どの言語を触っていても必ず付いてくるものですが、逆に言うと理解さえしてしまえば別の言語を触る時にも「アッ……これ、でやったやつだ……」と役に立つ基礎がいくつかあると思っております。 |
2021-11-25 20:10:03 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
変数とは何か、わかりやすく解説してみた【OBGノウハウ】 |
https://qiita.com/kana_mura/items/74799b052b79ae88257a
|
変数とは何か、わかりやすく解説してみた【OBGノウハウ】どのプログラミング言語を学んでいる上でも絶対必要となる知識がいくつかあると思うのですが、今回は初歩の初歩変数について私なりの解釈と講習会で使用している説明でのたとえ話なんかをまとめてみましたRPAツールやpythonやjs……どの言語を触っていても必ず付いてくるものですが、逆に言うと理解さえしてしまえば別の言語を触る時にも「アッ……これ、でやったやつだ……」と役に立つ基礎がいくつかあると思っております。 |
2021-11-25 20:10:03 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
gccの-zlazyとは何をするオプションなのでしょうか? |
https://teratail.com/questions/370999?rss=all
|
gccのzlazyとは何をするオプションなのでしょうか前提・実現したいことセキュリティコンテストチャレンジブックという本でltraceの使い方を学んでいます。 |
2021-11-25 20:56:34 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
jsで+を-に、nth-of-firstのみanswer表示したい |
https://teratail.com/questions/370998?rss=all
|
jsでをに、nthoffirstのみanswer表示したい前提・実現したいこと表題の通り、に表示させたいをーに※応用のようにしたいでnthoffirstのanswerのみ表示させたい発生している問題・エラーメッセージaccordionはできるが、表題の通りにならない試したこと・それぞれ調べ、試行錯誤したができなかった。 |
2021-11-25 20:52:04 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
MeCab-pythonをm1Macで使用したいがアーキテクチャが違う |
https://teratail.com/questions/370997?rss=all
|
MeCabpythonをmMacで使用したいがアーキテクチャが違うMeCabをpython上で使用したいのですが、エラーが出てしまい実行できません。 |
2021-11-25 20:34:37 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
admin/createに移動したいけど、うまくできない |
https://teratail.com/questions/370996?rss=all
|
|
2021-11-25 20:32:51 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Docuworks APIをEXCEL VBAから利用する方法。 |
https://teratail.com/questions/370995?rss=all
|
DocuworksAPIをEXCELVBAから利用する方法。 |
2021-11-25 20:31:49 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
[C++] inline関数での二重定義 |
https://teratail.com/questions/370994?rss=all
|
Cinline関数での二重定義下記のnbspquotvoidnbspfuncquotは、両方とも実体を持っているのか下記のコードをコンパイルampリンクしたところ、エラーがでずにコンパイラを通りました。 |
2021-11-25 20:21:10 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
tweepyを使って画像付きのツイートをしたいです。 |
https://teratail.com/questions/370993?rss=all
|
tweepyを使って画像付きのツイートをしたいです。 |
2021-11-25 20:20:47 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
リスト内の要素の足していき、ある数字を超えた時にどこで超えたかを出力したい |
https://teratail.com/questions/370992?rss=all
|
ablis |
2021-11-25 20:14:18 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Unity: 新しいInput Systemを用いたスワイプとタップ機能の導入 + 常に指の座標を取得し続ける方法について |
https://teratail.com/questions/370991?rss=all
|
Unity新しいInputSystemを用いたスワイプとタップ機能の導入常に指の座標を取得し続ける方法についてインプット機能スワイプ、タップ関連初心者です。 |
2021-11-25 20:08:56 |
Linux |
Ubuntuタグが付けられた新着投稿 - Qiita |
SPRESENSEのはじめかた |
https://qiita.com/tagucchan/items/6dbec596fd9ffd7c5330
|
ウインドウの拡大縮小などが出来るようになっているはずですUSBの設定同様にシステムを停止しますホストOSがWindowsの場合SpresenseボードをUSBシリアルで接続するために、ドライバをインストールWindowsの場合CPxUSBtoserialdriverforWindowsWindowsの場合CPxUSBtoserialdrivervforWindowsWindowsの例ダウンロードファイルを解凍し、フォルダCPxUniversalWindowsDriverを開くbitの場合はCPxVCPInstallerxexeを起動bitの場合はCPxVCPInstallerxexeを起動SpresenseをUSBケーブルでホストPCWindowsに接続しますデバイスマネージャーでSliconLabsCP・・・が認識されますVirtualBoxの仮想OSgt設定gtUSBgt右端上からつ目USBとのアイコンを左クリックSliconLabsCP・・・を左クリックgtUSBデバイスフィルタに追加されるOKボタンで画面を閉じます開発環境のセットアップ開発用アプリケーションのインストールmakeなど開発に必要なものが無いため、インストールしますsudoaptgetinstallbuildessentialシリアル通信の設定ログイン中のユーザーをdialoutグループに追加し、再起動しますsudousermodaGdialoutログイン中のユーザー名sudoshutdownrnow例sudousermodaGdialouttag起動後、ログインし、Ubuntu上でのシリアルポート名を確認devに出力されたttyUSBを追加したものがシリアルポート名です以下の例ではシリアルポート名はdevttyUSBになりますdmesggrepcpattachedusbcpxconverternowattachedtottyUSBSpresense開発環境に必要なアプリケーションのインストール必要なツールを以下のコマンドでダウンロード、インストールしますしばらく時間がかかりますmkdirpDevSpresensecdDevSpresensewgetbashinstalltoolssh注意Proxy設定が必要なネットワークネットワークエラーになる場合、以下のコマンド投入後にwgetを再実行することexporthttpproxyhttpプロキシーサーバー名IPアドレスポート番号exporthttpsproxyhttpプロキシーサーバー名IPアドレスポート番号ツールを利用するための設定を反映sourcespresenseenvsetupcpbashrcbashrcorgechosourceHOMEspresenseenvsetupgtgtbashrcSpresenseSDKリポジトリからソースコードをダウンロードし、開発環境をビルド、インストールしますcdDevSpresensegitclonerecursiveVSCodeのインストールVSCodeは様々な環境で動作する開発者向けのツールです編集、デバッグ、デプロイなどが、つのアプリケーションで実施でき便利ですVSCodeのインストーラをダウンロード注意VirtualBoxのUbuntuにログインして作業します画面左端からFireFoxWebブラウザアイコンをダブルクリックし起動しますVSCodeウエブサイトのURLUbuntuはdebの方を左クリック練習のために、今回はファイルを保存ダウンロードを選びOKボタンを押しますダウンロードが完了後、完了しました表示が出ますファイルを確認するため端末アプリを起動左下gt端末を検索ダウンロードしたファイルを確認英語と日本語の切替はcontrolspacecontrolとspaceを同時に押すcdダウンロードtagIoTUbuntuダウンロードlscodeamddebダウンロードしたファイルからVSCodeをインストールsudoaptinstallcodeamddebVSCodeの日本語化JapaneseLanguagePackをインストールして表示内容やメニュー等を日本語にしますインターネットに接続した状態でVSCodeを起動します画面左下gtVSCodeを検索起動後、しばらく待つと右下にJapaneseLanguagePackをインストールして再起動が出ます表示されない、消えた場合はVSCodeを×で終了後、再度起動してください自動的にVSCodeが再起動され、表示が日本語に変わりますVSCodeにSpresense拡張機能をインストールSpresense開発をVSCodeで行えるようにSpresense拡張機能をインストールしますVSCode左端の拡張機能アイコンを押すspresenseを検索し、インストールインストールが開始されますワークスペースの作成Spresense拡張機能のSpresenseWorkspaceSetupWizardを使って開発用のディレクトリを作成します今回作成するワークスペースは以下の構成になります・SpresenseSDKパスDevSpresensespresense・プロジェクトフォルダーパス新規に作成しますDevSpresensemyproject・ワークスペースファイルワークスペース情報の保存先、後ほど作成DevSpresensemyprojectcodeworkspaceFキーを押し、検索画面へSpresenseWorkspaceと入力SpresenseWorkspaceSetupWizardを選択し、起動しますそれぞれの参照ボタンを押し、ディレクトリを選択していきますSpresenseSDKのデイレクトリを開き、右上のOKボタンを押すプロジェクトフォルダーパス新規に作成しますDevSpresenseに、myprojectディレクトリを新規作成プロジェクトフォルダーパス新規に作成しますを開いた状態になるので、右上のOKボタンを押す作成ボタンを押します信頼しますかと聞かれるのではいボタンを押します作成したワークスペースをメニューのファイルgt名前を付けてワークスペースを保存で、保存しておきますDevSpresenseに、myprojectcodeworkspaceで保存HelloSpresenseの表示アプリケーションコマンドの追加・追加対象プロジェクトフォルダーDevSpresensemyproject・アプリケーションコマンド名myappsFキーを押し、検索画面へSpresenseprojectと入力SpresenseAddtoprojectholderを選択し、起動します次へを押します複数出る場合は、追加したい先を選択することアプリケーションコマンドを選択し、次へボタンを押しますアプリケーションコマンド名myappsを入力し、作成ボタンを押しますmyappsmaincが開きますプログラムを修正myappsmaincを全て削除し、以下のプログラムを記載しますmyappsmaincincludeltsdkconfighgtincludeltstdiohgtintmyappsmainintargccharargvprintfHelloSpresensenreturnファイルgt保存もしくはctrolcで変更を保存しますビルドのコンフィグレーションビルドプログラムをコンパイルしSpresenseが実行できるデータにすることを行うための事前設定をします画面右下にCにお勧めの拡張機能をインストールしますかが出ている場合は、インストールしてくださいCCの拡張パックがインストールされますFキーを押し、検索画面へspresensesdkと入力SpresenseSDKConfigを選択し、起動しますmyprojectを選びますコンフィグレーションメニューの起動に少し時間がかかりますコンフィグレーションメニューが表示されたら新規追加を左クリック何も選択せずにOKを左クリックプロジェクトのビルド注意修正したプログラムSpresenseで動作するためのプログラムがビルド対象になるため、環境によっては数十分かかりますVSCode左端、一番上のアイコンを左クリックしエクスプローラーを開くmyprojectビルドしたいプロジェクトフォルダーの上で右クリック、プロジェクトメニューからSpresenseアプリケーションのビルドを選択VSCode右下にビルドしていますが表示されますこちらの画面はxで閉じても構いませんビルドが終了するまでターミナルはタスクで再利用されます、閉じるには任意のキーを押して下さい。 |
2021-11-25 20:41:16 |
技術ブログ |
Developers.IO |
[アップデート] Amazon OpenSearch Serviceで設定変更によってBlue/Greenデプロイが走るかを事前チェックできるようになりました |
https://dev.classmethod.jp/articles/update-amazon-opensearch-service-check-blue-green-deployment/
|
amazon |
2021-11-25 11:52:47 |
海外TECH |
MakeUseOf |
PC Building, Retro Games, Casual Games, and Memories |
https://www.makeuseof.com/pc-building-retro-games-casual-games-and-memories/
|
casual |
2021-11-25 11:30:12 |
海外TECH |
MakeUseOf |
How to Change the Snooze Time on iPhone |
https://www.makeuseof.com/how-to-change-snooze-time-on-iphone/
|
snooze |
2021-11-25 11:16:12 |
海外TECH |
DEV Community |
How to handle JWT & Http-Only Cookies Authentication with Next.js |
https://dev.to/calebbenjin/how-to-handle-jwt-http-only-cookies-authentication-with-nextjs-3bc3
|
How to handle JWT amp Http Only Cookies Authentication with Next js Summary Greeting folks If you don t want to save your JWT token in the client side then I believe that s why you re here So welcome In this article am going to show you how to handle authentication JWT amp HttpOnly Cookies with Next js This example will go with any API endpoints you are using In order to follow along with the project I create a starter project where all the styling is done so we can just focus on handling all the required Authentications in our application You can grab it here Starter files What We re Going To CoverWhat Is JWT JSON Web Token Dos and Don tOur JWT Strategy ExplainedCloning And Setting Up Our ProjectSetting Up AuthContextLogin And Get JWTStore JWT In Server HttpOnly CookiePersist Logged in UserLogout And Destroy CookieRegister User What Is JWT A JSON Web Token JWT is really just a way to transmit information between two parties One party might be your frontend React application and another party might be your API The real value of JSON Web Tokens is they include a security feature That is you can be sure that the information that was transmitted in the token wasn t tampered with along the way JSON Web Token Dos And Don tI wanted to outline some do s and don ts Let s start with the don ts The first don t that I ve got is don t store your tokens in Local Storage The reason that it s risky to keep them in local storage is that local storage is easily scriptable The next don t that I ve got is don t keep these secret keys that go into signing your tokens in the browser The only place that you should be keeping your secret keys is on your backend because browsers are public clients Any time a user loads up a website or an application they get all of the code that goes into powering that application Now for the Do s Do keep long strong unguessable secrets Keep something that is super long strong and unguessable Our JWT Strategy ExplainedNow what we are going to do in our application is create an API routes within Nextjs which run on the server side We are going to have routes that we can hit then from there we will make our request to the API Endpoint get the token and then we will set the cookie on the server side what s called the Http Only Cookie that means it can t be accessed via the browser local Storage so that s a saver way to go So let s dive into code and start to create our API routes Cloning And Setting Up Our ProjectSo like l said I have already created a starter files so Jump right in and clone it After cloning the app open it in your VScode and press crtl J your terminal will open then type yarn add or npm install to install all necessary dependences After that type npm run dev or yarn run dev Setting Up AuthContextNow we want to create our context we are going to use the Context API where we can store all our Authentication methods our users and also any errors that comes from authentication So we are going to create a new folder in the root called context then inside the context we re going to create a file called AuthContext js So We want to basically create a context using createContext from react So now go inside your AuthContext file and fill it with this code snippet below import useState useEffect createContext from react import useRouter from next router import NEXT URL from config index const AuthContext createContext export const AuthProvider children gt const user setUser useState null const error setError useState null const isLoading setIsLoading useState false const router useRouter Register user const register async fullname email password gt setIsLoading true console log fullname email password Login userconst login async email password gt setIsLoading true console log email password Logout user const logout gt console log User Logged out Check if user id Logged in const checkedUserLoggedIn async user gt console log Checked return lt AuthContext Provider value register login logout isLoading user error gt children lt AuthContext Provider gt export default AuthContextNow let me explain the code above We imported some necessary hooks from react like useState useEffect createContext and also useRouter from next router Next we imported our API URL this will be your API endpoint URL of choice Next we create a context by creating a variable called AuthContext and set it to createContext Next we created a provider that needs to wrap around our application so we can provides certain functions to our application and whatever component needed Next we created some state user setUser and error setError and we set the default to null Next we created some methods like register login logout checkUserLoggedIn which we will use to hit our backend routes Then as you can see we are exposing all the methods created so it can be accessible all over the application So let s do that by going into our app js file in the pages folder and bring in our AuthProvider as you can see below import styles globals css import Navbar from components Navbar import AuthProvider from context AuthContext function MyApp Component pageProps return lt AuthProvider gt lt Navbar gt lt Component pageProps gt lt AuthProvider gt export default MyApp Login amp Get JWTSo in this section we are going to setup our login functionality and get the JWT token we re not going to store it just yet but what we want to do is to create an api route to connect to and in that api route is were we are going to communicate with our backend endpoint we are going to send our request from there get the token and then our next step is to save the Http Only Cookie So let s dive right in by getting into our api folder and create a new file called login js Now copy the code below and paste in the login js file you have created I will explain things in details below import API URL from config index export default async req res gt if req method POST else res setHeader Allow POST res status json message Method req method not allowed First we import our API URL this can be your api url of choiceNext we create an async function and pass in our req res Next we want to make sure if is the req method is equal to POST else we want to res setHeader Allow POST and set the status res status which is method not allowed and send a json message Method req method not allowed Next after making sure is a post request we want to get the email and password from the req body so we do that by destructuring the email and password from req body Now in this our api route this were we want to login our user with actual backend api endpoint or l should say fetch our token Now go ahead and paste the code below inside of your code destructure email and password const email password req body Making a post request to hit our backend api endpoint const apiRes await fetch API URL your url of choice method POST headers Content Type application json body JSON stringify email password const data await apiRes json if apiRes ok todo Set Cookie res status json user data user else res status data statusCode json message data message So if you re following correctly your code show look like this below import API URL from config index export default async req res gt if req method POST const email password req body const apiRes await fetch API URL your url of choice method POST headers Content Type application json body JSON stringify email password const data await apiRes json console log data jwt if apiRes ok res status json user data user else res status data statusCode json message data message else res setHeader Allow POST res status json message Method req method not allowed So what we have done so far which is creating this api endpoint inside our Nextjs app is like a middle man between our frontend and the backend api and then we are doing this so we can set Http Only Cookie with token You can console log data jwt to see it Next let s head over to AuthContext and go to the login method we create so we can make a request to our api login api endpoint we have created So paste these code inside of the login function const res await fetch NEXT URL api login method POST headers Content Type application json body JSON stringify email password const data await res json if res ok setUser data user router push dashboard else setError data message setError null Now we are fetching the data from the api route we create in api login After that we check if the request is okay then we setUser data user and make a redirect to our dashboard using next router But if is not Ok then we want to setError data message and also setError null so the error will not remain in our state Next let s head on to our login page and bring in our login method from AuthProvider so now update your login page with these codeimport AuthContext from context AuthContext const login error user isLoading useContext AuthContext const handleLoginSubmit async email password gt login email password We are importing our AuthContext then we destructure out login error user isLoading from it Then in our handleLoginSubmit function we then call in the login email password and then pass in email and password Now at this point our app should be working very fine next we are going to go head and store our jwt in the server httpOnly Cookie Let s dive in Store JWT In Server HttpOnly CookieNow what we want to do is set the Cookies there s quite a few ways to do this but we are going to use a package called cookie that let s us easily set cookie on the server side if you check in our package json file you will see that l have install it already or you can install it yard add cookie or npm install cookie if you are not using the start file Next we going to bring in our api login js fileimport cookie from cookie So go down the code where we have our todo Set Cookie comment and add these code there res setHeader Set Cookie cookie serialize token String apiRes data token httpOnly true secure process env NODE ENV development maxAge week sameSite strict path Now as you can see we are setting res setHeader that s coming with Set Cookie and a second parameter of cookie serialize then we set the name of the cookie to be cookie serialize token and the value is going to be cookie serialize token String apiRes data token and we also have an object option which is the httpOnly true and secure since is going to be https and we want that to be true on production not development then we are going to set it to process env NODE ENV development and also check the node environment and see if that s not equal to development if is equal to development then is going to be false if is in production is going to be true Then we do maxAge is set to a week maxAge week then we set sameSite to strict and path is set to because we want it to be accessible everywhere So this will set the cookie on the server side once we login our app Persist Logged in UserNow we are going to persist the user and that is going to happen with the checkUserLoggedIn function we created in our AuthContext Now this checkUserLoggedIn is going to hit a new route called user so go ahead and create a user js file inside of our api folder Basically what we are going to do in this user js is to hit the users endpoint of your api what we can do is we can send our token which we have in our cookie right now once we send the token it will give you back the user for that token then what we do with in AuthContext is set the user Now go head and copy the code and paste in the user js file you have created import API URL from lib index import cookie from cookie export default async req res gt if req method GET if req headers cookie res status json message Not Authorized return const token cookie parse req headers cookie const apiRes await fetch API URL user method GET headers Authorization Bearer token const user await apiRes json if apiRes ok res status json user else res status json message User forbidden else res setHeader Allow POST res status json message Method req method not allowed export default userNow inside our function we are first checking to see if the cookie exist req headers cookie if that s not there then res status json message Not Authorized and then we return But if is found then we need to pass the cookie and get the token we then destructure the token const token cookie parse req headers cookie this will put the token into a variable and then we can send into our backend Api Once we get the user back and then check if the apiRes ok then we want to set the status and send the user object else the user is forbidden res status json message User forbidden Now let s save that and hit this api route with checkUserLoggedIn now let s go to our AuthContext and fill in out checkUserLoggedIn with this code just a simple get request const checkUserLoggedIn async gt const res await fetch NEXT URL api user const data await res json if res ok setUser data user data user else setUser null Now we are checking that if everything goes ok then we re setting setUser data user data user the user we get back from our backend api else we are going to setUser to null and then we want to call this up here in a useEffect so let s go under our state and call the useEffect useEffect gt checkUserLoggedIn Logout And Destroy CookieNow we are going to have another api route for this because we need to destroy the cookie that s going to happened in our server which in our api route So let s create a logout js in our api folder after we have done that go ahead and paste the code inside of the logout js file we just create I will explain the code below import cookie from cookie export default async req res gt if req method POST DESTROY COOKIE res setHeader Set Cookie cookie serialize token httpOnly true secure process env NODE ENV development expires new Date sameSite strict path res status json message Success else res setHeader Allow POST res status json message Method req method not allowed export default logoutAll we are doing here is just to destroy the cookie Now if you look at the cookie serialize token you will see that the token is now set to an empty string Next we replace the maxAge with expires and we want to set it to something that s pass and we did that by passing a new data and pass in zero And that s it this should destroy the cookie Now from our logout function in out AuthContext we just want to call that api logout js Now add these code inside of the logout function inside of the AuthContext const logout async gt const res await fetch NEXT URL api logout method POST if res ok setUser null router push login What we are doing here is simply hitting that api logout route and we then setUser null to null this will remove our cookie and redirect the user to the login page Now let s go to our Navbar components and bring in the logout method from AuthContext So now update your navbar component with this code belowimport useContext from react const logout user useContext AuthContext user lt gt lt Link href dashboard gt lt a gt Dashboard lt a gt lt Link gt lt div gt lt a onClick gt logout gt Logout lt a gt lt div gt lt gt null Now once you click on logout everything should be working very fine the cookie will be destroy Now the next thing is the register page basically this will do the same thing as login except it will create the user and then it will send back the token basically do the same thing the login response does Register UserNow let s go to our api folder and create our register js file Now go ahead and copy these code and paste inside of your register js file import API URL from config index import cookie from cookie const register async req res gt if req method POST const fullname email password req body const apiRes await fetch API URL your register endpoint method POST headers Content Type application json body JSON stringify fullname email password const resData await apiRes json console log resData data token if apiRes ok Set Cookie res setHeader Set Cookie cookie serialize token String resData data token httpOnly true secure process env NODE ENV development maxAge week sameSite strict path res status json user resData data else res status json message resData message else res setHeader Allow POST res status json message Method req method not allowed export default registerNow if you take a close look you will see that we are doing the same thing as the login route the little difference here is that we are accepting an extra field which is fullname So next let s dive right into the AuthContext and handle our register route we have just created You can copy these code below and paste it in the register async function we created Resister user const signup async fullname email password gt const res await fetch NEXT URL api register method POST headers Content Type application json body JSON stringify fullname email password const resData await res json if res ok setUser resData user router push dashboard else setIsError resData message setIsError null Now we are hitting the api register js route that we just created we are sending along the user object which is the fullname email password then we check to see if the response is ok if is okay then we set the user and push redirect to the dashboard and if there s an error we set that in the state Now let s go inside the register and update our handleRegisterSubmit with these code const handleRegisterSubmit async fullname email password gt register fullname email password Now you can go ahead and test your app everything should be working very fine now ConclusionSo having these API routes and being able to set an HTTP only cookie is another big benefit of using Next Js because is not something you can do with just React Where to store a JSON Web Tokens has always been kind of an issue with front end development So this does give us one solution Hello I hope you liked the article I am Caleb a JavaScript Developer It takes a lot of work to research and write such an article and a clap or a follow from you means the entire world to me It takes less than seconds for you and it helps me with reach You can also ask me any questions or point out anything or just drop a “Hey down there |
2021-11-25 11:35:46 |
海外TECH |
DEV Community |
Advanced Roadmap for React.js developers |
https://dev.to/dhiwise/advanced-roadmap-for-reactjs-developers-108d
|
Advanced Roadmap for React js developersThe React JS or React is an open source front end JavaScript library for building user interfaces or UI components It is maintained by Facebook and a community of individual developers and companies It has grown as one of the best libraries in recent years for component based GUI development Although there are other front end frameworks like Angular and Vue js available what sets React apart from others is it just focuses on component based GUI development and doesn t invade other areas Roadmap to becoming a React developer Below is the chart demonstrating the paths you can take and the libraries you would want to learn to become a React developer This chart is made by Adam Gołąb Note This roadmap will give you an idea about the landscape and guide you if you are confused about where to begin or what to learn next In the end it depends on your experience as you will grow some understanding of why one tool is better suited for some cases than the other one It is not necessary that handy and trendy one is always perfect So go through the map and start developing Roadmapby Adam Gołąb ResourcesReactStrapAnt DesignBlueprint JSEvergreenStorybookFor more details visit ReactJS UI Frameworks TestingIt is a vital skill for React Developers i Unit Testing Jest React testing library Enzyme Sinon Mocha Chai AVA Tapeii End to End Testing Selenium Webdriver Cypress Puppeteer Cucumber js Nightwatch jsiii Integration Testing Karma InternationalizationReact IntlReact inextThese libraries offer React components and an API to format dates strings and numbers including handling translations and pluralization Server Side RenderingNext jsAfter jsRogueFrotinityReact components are rendered on the server and the output HTML content is delivered to the client or browser Static Site GeneratorJamstackGatsbyYou can use Gatsby to create a personalized logged in experiences website They combine your data with JavaScript and create well formed HTML content Backend Framework IntegrationReact on RailsIt integrates Rails with server rendering of Facebook s React front end framework It provides Server rendering which is often used for SEO crawler indexing and UX performance and is not offered by rails webpacker MobileReact NativeCordova PhonegapThe standard way to develop a mobile application is in JavaScript with a native look and feel DesktopProton NativeElectronReact Native WindowsAllows you to build native UWP and WPF apps with React Virtual RealityReact This allows you to be exciting and VR experiences using React Conclusion If you think the roadmap can be improved please do open a PR with any updates and submit any issues on the original git repo Adam Golab s React developer roadmap That s all about The ReactJS RoadMap For Developers It s very comprehensive for sure but there is a good chance that many of you may already know most of the stuff Even if you don t know you need to be confused or overwhelmed by this roadmap you can start small and follow along Apart from this there is an article on the best ReactJS UI Frameworks and component libraries which will be helpful too There are many ways to becoming a React Developer and if you already know React you can surely find some more tools and technologies to add to your kitty and become even a better React Developer in About me I am a react js developer at DhiWise which is a ProCode platform that helps you build clean scalable and customizable Node js Kotlin and React code Focus on what matters as a programmer and let DhiWise do the rest Also If you wish to learn Advanced react component patterns please find it here By Ravi Sojitra Tech Lead DhiWise |
2021-11-25 11:15:46 |
海外TECH |
DEV Community |
Why is Git Important? |
https://dev.to/heyvik/why-is-git-important-46l9
|
Why is Git Important Git is useful for everyone who develops code or tracks changes to files from web developers to app developers So What is purpose of Git and Why you should consider utilizing it The most widely used version control system is Git Git keeps track of the changes you make to files so you can see what you ve done and go back to previous versions if you need to Git also facilitates cooperation by allowing several people s modifications to be merged into a single source All of the project files as well as the whole revision history are stored in a Git repository You ll instruct Git to turn a regular collection of files such as a website s root folder into a repository This generates a git subfolder with all of the Git metadata needed to track changes Follow me on Twitter Files and folders that begin with a period are hidden on Unix based operating systems like macOS so you won t see the git folder in the macOS Finder unless you enable hidden files but it s there In some coding editors you might be able to see it Why do we need Git Many developers have reaped significant benefits from the Git system It s an open source platform that allows programmers to demonstrate their abilities It has gained widespread acceptance as a version controlled technology It is required to carry out particular tasks which include the following Easy reverts are possible This feature is not compatible with a number of programmes It has made a significant difference in comparison to those applications It s useful for going back to old records Concept of branching Projects are frequently done in simultaneously In such a situation a comparable code is required It is a wonderful solution for dealing with such a problem Parallel projects are easily supported with several branches Marketing with GitConsider how switching to Git would effect your company s marketing efforts Assume your development team has three major improvements coming up in the next several weeks The entire team is nearing completion on a game changing feature that has been in the works for the past six months Mary is putting in place a minor unrelated enhancement that will only affect existing clients Rick is updating the user interface which is long overdue All of these changes would most likely be rolled up into a single release if you re using a typical development workflow that relies on a centralized VCS The marketing potential of the other two updates is effectively neglected because marketing can only make one announcement that focuses primarily on the game changing feature Git for designersRapid prototyping is easier with feature branches Checking out a new branch allows your UX UI designers a sandboxed environment to play with whether they want to construct an entirely new user flow or simply alter some icons This allows designers to see their modifications in a live working copy of the product without risking damaging existing functionality Pull requests go a step further by establishing a formal forum for interested parties to discuss the new interface Designers can make any necessary modifications and the pull request will indicate the resultant commits This encourages everyone to join in the iteration process Thanks for reading this blog cheers |
2021-11-25 11:08:36 |
海外TECH |
CodeProject Latest Articles |
VoiceNET Library |
https://www.codeproject.com/Articles/5318513/VoiceNET-Library
|
command |
2021-11-25 12:00:00 |
ニュース |
BBC News - Home |
Channel deaths: More boats arrive after 27 people drown |
https://www.bbc.co.uk/news/uk-59412329?at_medium=RSS&at_campaign=KARANGA
|
channel |
2021-11-25 11:30:00 |
ニュース |
BBC News - Home |
Asylum claims to UK reach highest level in nearly 20 years |
https://www.bbc.co.uk/news/uk-politics-59414460?at_medium=RSS&at_campaign=KARANGA
|
figures |
2021-11-25 11:49:24 |
ニュース |
BBC News - Home |
The Star Inn at Harome: Michelin-starred restaurant 'reduced to ashes' |
https://www.bbc.co.uk/news/uk-england-york-north-yorkshire-59414420?at_medium=RSS&at_campaign=KARANGA
|
blaze |
2021-11-25 11:37:08 |
ニュース |
BBC News - Home |
Richard Madeley: I'm a Celebrity star taken to hospital |
https://www.bbc.co.uk/news/entertainment-arts-59414721?at_medium=RSS&at_campaign=KARANGA
|
hospitalthe |
2021-11-25 11:15:28 |
ニュース |
BBC News - Home |
Jennifer and Stephen Chapple: Man appears in court over murders |
https://www.bbc.co.uk/news/uk-england-somerset-59414106?at_medium=RSS&at_campaign=KARANGA
|
chapple |
2021-11-25 11:51:28 |
ニュース |
BBC News - Home |
London Stratford emerges as UK's busiest station |
https://www.bbc.co.uk/news/business-59414795?at_medium=RSS&at_campaign=KARANGA
|
covid |
2021-11-25 11:05:47 |
ニュース |
BBC News - Home |
Women's safety: Clubs see rising demand for self-defence classes |
https://www.bbc.co.uk/news/uk-england-london-59403257?at_medium=RSS&at_campaign=KARANGA
|
classes |
2021-11-25 11:26:59 |
LifeHuck |
ライフハッカー[日本版] |
ストレスの「限界」がくる前に、やっておきたい行動リスト5選 |
https://www.lifehacker.jp/2021/11/246399how-to-take-a-rest.html
|
限界 |
2021-11-25 21:00:00 |
北海道 |
北海道新聞 |
欧州、中国外交に警戒感 EU委員長、国際秩序を強調 |
https://www.hokkaido-np.co.jp/article/615634/
|
中国外交 |
2021-11-25 20:19:00 |
北海道 |
北海道新聞 |
教員ら窃盗などで4人処分 道教委 |
https://www.hokkaido-np.co.jp/article/615633/
|
懲戒処分 |
2021-11-25 20:19:00 |
北海道 |
北海道新聞 |
国際バルク戦略港湾の釧路港の将来像など議論 ザ・シンポジウムみなとin釧路 |
https://www.hokkaido-np.co.jp/article/615631/
|
国際バルク戦略港湾 |
2021-11-25 20:17:03 |
北海道 |
北海道新聞 |
道内ガソリン3週連続値下がり 灯油は9週連続上昇 備蓄放出効果じわり |
https://www.hokkaido-np.co.jp/article/615629/
|
値下がり |
2021-11-25 20:10:00 |
北海道 |
北海道新聞 |
学生柔道、福田や古枝らが初優勝 全日本体重別 |
https://www.hokkaido-np.co.jp/article/615628/
|
千葉ポートアリーナ |
2021-11-25 20:07:00 |
北海道 |
北海道新聞 |
<日本ハム契約更改>12人がサイン 細川50万円増 |
https://www.hokkaido-np.co.jp/article/615530/
|
契約更改交渉 |
2021-11-25 20:05:40 |
北海道 |
北海道新聞 |
「農業高生の甲子園」 後志の2人が優秀賞 |
https://www.hokkaido-np.co.jp/article/615575/
|
全国大会 |
2021-11-25 20:06:05 |
IT |
週刊アスキー |
新作MMORPG『ELYON』が『TERA』と『AVA』の2作品と相互プレイキャンペーンを開催! |
https://weekly.ascii.jp/elem/000/004/076/4076184/
|
新作MMORPG『ELYON』が『TERA』と『AVA』の作品と相互プレイキャンペーンを開催年月日、ゲームオンは新作MMORPG『ELYON』にて、同社が運営する大型ファンタジーMMORPG『TERATheExiledRealmofArborea』とオンラインFPS『AllianceofValiantArms』のそれぞれタイトルと相互プレイキャンペーンを開催。 |
2021-11-25 20:30:00 |
IT |
週刊アスキー |
タイムループ探索ADV『アサツグトリ』本日発売!ヒバリのドッグタグが当たるTwitterキャンペーンも開催 |
https://weekly.ascii.jp/elem/000/004/076/4076183/
|
nintendo |
2021-11-25 20:25:00 |
コメント
コメントを投稿