投稿時間:2023-03-02 02:19:55 RSSフィード2023-03-02 02:00 分まとめ(28件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
python Pythonタグが付けられた新着投稿 - Qiita 【Python+Django+Docker+VS Code】APIでJson取得しJson形式を返却する https://qiita.com/nonkapibara/items/77c7e6bb0c6fe0a040cf docker 2023-03-02 01:50:26
python Pythonタグが付けられた新着投稿 - Qiita サーバー間で画像のやり取りをする方法 https://qiita.com/betio/items/4ba6424628304277c9e9 送受信 2023-03-02 01:38:51
python Pythonタグが付けられた新着投稿 - Qiita 【APIテスト】VS CodeのREST ClientでAPIテストする https://qiita.com/nonkapibara/items/83bcd01c4e32c03d13e7 docker 2023-03-02 01:30:21
python Pythonタグが付けられた新着投稿 - Qiita yfinanceでビットコインの時系列データを取得する(1日ごと、1時間ごと) https://qiita.com/__x__/items/6af051cb6b4017a52bd5 googlecolaboratoryyfinanc 2023-03-02 01:21:30
js JavaScriptタグが付けられた新着投稿 - Qiita ChatGPT Plus に 1ヶ月だけ課金したので(?)Node.js・JavaScript のプログラムを少し書いてもらった https://qiita.com/youtoy/items/6869a069cff43e98a0d0 chatgptplus 2023-03-02 01:01:12
Docker dockerタグが付けられた新着投稿 - Qiita 【Python+Django+Docker+VS Code】APIでJson取得しJson形式を返却する https://qiita.com/nonkapibara/items/77c7e6bb0c6fe0a040cf docker 2023-03-02 01:50:26
Docker dockerタグが付けられた新着投稿 - Qiita 【APIテスト】VS CodeのREST ClientでAPIテストする https://qiita.com/nonkapibara/items/83bcd01c4e32c03d13e7 docker 2023-03-02 01:30:21
海外TECH MakeUseOf WhatsApp Web Not Working in Google Chrome? Try These 8 Fixes https://www.makeuseof.com/whatsapp-web-google-chrome-fixes/ chrome 2023-03-01 16:30:17
海外TECH MakeUseOf How to Fix a Display Not Turning On When Booting Up Windows https://www.makeuseof.com/display-not-turning-on-windows/ windows 2023-03-01 16:15:18
海外TECH DEV Community Automate Docker Image Builds and Push to Docker Hub Using GitHub Actions 🐳🐙 https://dev.to/ken_mwaura1/automate-docker-image-builds-and-push-to-docker-hub-using-github-actions-32g5 Automate Docker Image Builds and Push to Docker Hub Using GitHub Actions New month new blog post IntroductionIn this tutorial we will be building a Docker image of an existing project and pushing it to Docker Hub using GitHub Actions We will be using the following technologies DockerGit and GitHub obviously GitHub ActionsDocker Hub Overview The Problem ️We want to build a Docker image and push it to Docker Hub whenever we push to the main branch We also want to build a Docker image and push it to GitHub Packages whenever we push to the dev branch We want to do this automatically using GitHub Actions We want to be able to do this without exposing our Docker Hub credentials The Solution We will use GitHub Actions to build and push Docker images to Docker Hub We will use the following steps Create a workflow file Add a job to build and push the Docker image to Docker Hub Commit and push the changes to the dev branch Specify our docker crenentials as secrets in the repository settings Open a pull request to merge the dev branch into the main branch Watch the workflow run and verify that the Docker image is pushed to Docker Hub Prerequisites A GitHub account A Docker Hub account Docker installed on your machine You can follow the official documentation to install Docker on your machine A GitHub repository with a Dockerfile and a project that you want to build and push to Docker Hub Step Create a workflow file All GitHub Actions workflows are defined in YAML files in the github workflows directory of your repository We ll stary by creating a workflow file for building and pushing the Docker image to Docker Hub Create a file named github workflows docker hub yml in your repository This file will contain the workflow that we will use to build and push the Docker image The workflow will be triggered whenever we push to the main or dev branch We will also specify the Docker image name and tag We will use the following workflow name Build and Push Docker Image to Docker Hubon push branches dev main pull request branches dev main env Use docker io for Docker Hub if empty REGISTRY docker io github repository as lt account gt lt repo gt IMAGE NAME github repository jobs build runs on ubuntu latest steps uses actions checkout v name Build the Docker image run docker compose build no cache force rm test runs on ubuntu latest steps uses actions checkout v name Test the Docker image run docker compose up d push to registry name Push Docker image to Docker Hub runs on ubuntu latest steps name Check out the repo uses actions checkout v name Set up Docker Buildx uses docker setup buildx action v name Log in to Docker Hub uses docker login action fabaffcfaeeffc with username secrets DOCKER USERNAME password secrets DOCKER PASSWORD name Extract metadata tags labels for Docker id meta uses docker metadata action aeeacffbcbaacfcbbfcc with images env REGISTRY env IMAGE NAME name Build and push Docker image uses docker build push action v with context defaultContext push true tags steps meta outputs tags labels steps meta outputs labels Lets break down the workflow file name The name of the workflow on The events that trigger the workflow We will trigger the workflow whenever we push to the main or dev branch env The environment variables that we will use in the workflow We will use the following environment variables REGISTRY The registry that we will use to push the Docker image We will use docker io for Docker Hub IMAGE NAME The name of the Docker image We will use the name of the repository as the name of the Docker image jobs The jobs that will run in the workflow We will use the following jobs build The job that will build the Docker image We will use the following steps Checkout We will use the actions checkout action to checkout the repository Build the Docker image We will use the docker compose build command to build the Docker image We will use the no cache and force rm flags to ensure that we are building the Docker image from scratch This will ensure that we are building the Docker image with the latest changes before pushing it to Docker Hub test The job that will test the Docker image We will use the following steps Checkout We will use the actions checkout action to checkout the repository Test the Docker image We will use the docker compose up d command to test the Docker image We will use the d flag to run the Docker image in the background push to registry The job that will push the Docker image to Docker Hub We will use the following steps Check out the repo We will use the actions checkout action to checkout the repository Set up Docker Buildx We will use the docker setup buildx action action to set up Docker Buildx Log in to Docker Hub We will use the docker login action action to log in to Docker Hub We will use the following inputs username The username of the Docker Hub account We will use the DOCKER USERNAME secret password The password of the Docker Hub account We will use the DOCKER PASSWORD secret Extract metadata tags labels for Docker We will use the docker metadata action action to extract the metadata for the Docker image We will use the following inputs images The name of the Docker image We will use the REGISTRY and IMAGE NAME environment variables Build and push Docker image We will use the docker build push action action to build and push the Docker image to Docker Hub We will use the following inputs context The context of the Docker image We will use the defaultContext variable push A boolean value that specifies whether to push the Docker image to Docker Hub We will set this to true tags The tags of the Docker image We will use the tags output of the docker metadata action action labels The labels of the Docker image We will use the labels output of the docker metadata action action Step Create a dev branch and commit the changes to the dev branch Create a dev branch and commit the changes to the dev branch This will allow us to test the workflow before merging the changes to the main branch We will use the following commands git checkout b devgit add git commit m Add workflow to build and push Docker image to Docker Hub Step Push the changes to the dev branch ‍Create a Github Repository if you dont already have one and push the changes to the dev branch We will use the following commands git add git commit m Add workflow to build and push Docker image to Docker Hub git push u origin dev Step Specify our docker credentials as secrets in the repository settings We will specify our Docker Hub credentials as secrets in the repository settings We will use the following secrets DOCKER USERNAME The username of our Docker Hub account DOCKER PASSWORD The password of our Docker Hub account This will allow us to use the credentials in the workflow file without exposing them Thus keeping sensitive information secure This gives the workflow access to the Docker Hub account As well ability to use the workflow across multiple repositories Step Open a pull request to merge the dev branch into the main branch ️Once the workflow successfully runs on the dev branch we can merge the changes to the main branch Open a pull request to merge the dev branch into the main branch This will trigger the workflow The workflow will run on the main branch and push the Docker image to Docker Hub Example of successful workflow run on open pull request Step Watch the workflow run Watch the workflow run and verify that the Docker image is pushed to Docker Hub Login to Docker Hub and check if the image is successfully pushed to Docker Hub The image should be pushed to Docker Hub with the appropriate tags for example kenmwaura fastapi vue main and kenmwaura fastapi vue sha lt sha gt Example of successful workflow run on merge pull request Screenshot of workflow running on merge pull request Step Verify that the Docker image is pushed to Docker Hub Login to Docker Hub and check if the image is successfully pushed to Docker Hub The image should be pushed to Docker Hub with the appropriate tags for example kenmwaura fastapi vue main and kenmwaura fastapi vue sha lt sha gt Example of image pushed to Docker Hub GitHub Repo for this tutorial Find the sample code for this workflow in the following GitHub repository KenMwaura Fast Api Vue Simple asynchronous API implemented with Fast Api framework utilizing Postgres as a Database and SqlAlchemy as ORM GiHub Actions as CI CD Pipeline Vue Daisy UI for the frontend FastAPI Vue Starter App This repository contains code for asynchronous example api using the Fast Api framework Uvicorn server and Postgres Database to perform crud operations on notes Accompanying ArticleInstallation method Run application locally Clone this Repogit clone Cd into the Fast Api foldercd Fast Api exampleCreate a virtual environmentpython m venv venvActivate virtualenvsource venv bin activateFor zsh userssource venv bin activate zshFor bash userssource venv bin activate bashFor fish userssource venv bin activate fishCd into the src foldercd srcInstall the required packagespython m pip install r requirements txtStart the apppython main pyb Start the app using Uvicornuvicorn app main app reload workers host port Ensure you have a Postgres Database running locallyAdditionally create a fast api dev database with user fast api having required privilegesORChange the DATABASE URL variable in the env file inside then app folder to reflect database settings user password db … View on GitHubFind the docker image on Docker Hub Fastapi Vue Conclusion 🫔In this tutorial we learned how to build and push Docker images to Docker Hub and GitHub Packages using GitHub Actions We also learned how to specify our Docker Hub credentials as secrets in the repository settings Next StepsOn the next tutorial we will learn how to build and push Docker images to GitHub Packages using GitHub Actions Stay tuned References GitHub ActionsGitHub Actions DockerGitHub Actions Docker metadataGitHub Actions Docker loginGitHub Actions Docker build and pushGitHub Actions Docker buildxDocker Hub 2023-03-01 16:47:06
海外TECH DEV Community Next.js 13 special files, data fetching and head tag — page, layout and template https://dev.to/oskidev/nextjs-13-special-files-data-fetching-and-head-tag-page-layout-and-template-1hh Next js special files data fetching and head tag ーpage layout and templateBefore we start note that by default components in Next js are Server Components This roughly means that you can t use client side effects and actions like useEffect useState onClick etc You can make component client side by adding use client directive on top of the component over the imports Server Components also improve performance by reducing the amount of JavaScript sent to a client make it easier to fetch data are better for SEO because search engine bots can easily access the HTML content of the page and don t need to wait for client side code execution If you want to know the basics of the routing and app directory you can visit the previous article PagesThe most important file in the new app directory is the page This is because the page file makes the route publicly accessible You create page by exporting the function as default from the page tsx file like in the example below You can call the function whatever you want LayoutsIn layout tsx you create a UI that is shared between multiple child pages So you can create a UI for company about and this layout will be applied to all pages under route company about but not for siblings routes like company career You can create a layout at any level of the route On navigation layouts preserve state remain interactive and do not re render You can create a layout by exporting the function as default from the layout tsx file Note that the top most layout function is called RootLayout any other layout you can call as you want In the example below you can see RootLayout which is required In root layout you should include html and body tags Any other layout can look like this layout for about page You can wrap the children in whatever you want Each layout accepts the children prop that will be populated with child layouts and pages TemplatesTemplates are similar to layouts they also wrap each child layout and page but templates create a new instance for each of their children as they navigate as opposed to layouts that persist on routes and preserve state This means that if you navigate between routes that share a template DOM elements are recreated and new instance of the component are mounted You can create a template just like a common layout Note that if you don t have a specific reason to use template you should use layout Templates may be useful for cases like Enter exit animations using CSS or animation libraries Features that rely on useEffect e g logging page views and useState e g a per page feedback form To change the default framework behavior For example Suspense Boundaries inside layouts only show the fallback the first time the Layout is loaded and not when switching pages For templates the fallback is shown on each navigation Data fetchingPages and layouts like other components can fetch data Because of the new Server Components fetching data in Next js became really handy and have a lot of advantages You can also fetch data in Client Components Libraries such as SWR or React Query are recommended in Client Components In the future it ll be also possible using use hook You can access the new data fetching system using native fetch Web API and use async await in Server Components You can fetch data in multiple components Next js will automatically cache requests GET that have the same input in temporary cache This way you avoid situations in which the same data can be fetched more than once It is useful for fetching data in layouts because it s not possible to pass data between parent layout and its children Just fetch data directly inside the layout that needs it and Next js will take care of caching and deduping requests Two data fetching patternsparallel data fetching if you don t have one query dependent on the previous one you can use parallel data fetching This reduces client server waterfalls and the total time it takes to load data because requests in a route are eagerly initiated and starts fetching at the same time sequential data fetching if you have one query dependent on the previous one you can use sequential data fetching This can lead to longer loading time but it is useful in cases where one fetch depends on the result of the previous one If you want to know more about data fetching patterns visit Next js documentation If you want to expand your knowledge in general about data fetching in Next js here is the link Modifying head tagOne more thing you should know is a new way of modifying head tag If you use static values in head tag If you use dynamic data in head tag That s all in this article If you want to expand your knowledge check out the documentation I hope you enjoyed 2023-03-01 16:34:45
海外TECH DEV Community The Price Developers Pay for Loving Their Tools Too Much https://dev.to/remotesynth/the-price-developers-pay-for-loving-their-tools-too-much-1f0a The Price Developers Pay for Loving Their Tools Too MuchDevelopers are passionate their tools This is totally understandable They invest years of learning into them Their livelihoods depend on their expertise with them Their professional community is built around them They can become deeply invested in them because it seems apparent that their success is somehow tied to the success of the tool Which brings us to the current debate about React I won t rehash the debate since I m not here to argue over the pros and cons of React or other front end frameworks Suffice it to say the debate has gotten pretty intense and at times has seemed pretty personal This brought back parallels from my own career journey and some lessons that I learned in the aftermath The Rise and Fall of Flash and FlexDave Rupert had a weirdly timely post about Adobe Flex recently He clearly intended it as commentary on the current debate in the web community and based on my experience the parallels he implies are accurate For those that don t remember it Adobe Flex was a way to build web applications using Flash Web standards at the time were essentially frozen in the past For instance HTML was proposed in and had been last updated in in HTML wasn t even proposed until and those who were around know it took years for much of it to show up in the browser Flash and later Flex which was released in were filling the gap in web standards allowing for animation styling interactivity that was largely impossible on the standards based web at the time To say that I was deeply invested in Flash and Flex would be an understatement I had been using Flash since around when I d initially started my career and had committed to focusing on Flex in particular around I wrote articles and spoke at conferences about Flex and many of the Flex meta frameworks yuck Cairngorm yay Mate I even started my own conference about Flex in In I was hired by Adobe as the Content and Community Manager for Flash and Flex When I was a younger developer I was incredibly passionate about the tools I used and even moreso about Flash and Flex given that my career at the time revolved around them In Steve Jobs published his famous Thoughts on Flash Putting aside any debate over the merits or motivation of his particular argument it threw a major curveball at my career Over the next year the criticism of Flash and Flex was unrelenting and seemingly coming from everywhere Within less than a year of that post my decade or more of Flash and Flex experience was over  literally from one day to the next A massive re org at Adobe signaled the beginning of the end for Flash and Flex I was fortunately spared from layoffs but by that afternoon my job had nothing to do with either tool Instead I was now focused on web standards and JavaScript In a developer career that had begun around I had never known web development without Flash Yet I have not touched Flash in the decade plus since that day Parallels with ReactReact was first released in According to the most recent StackOverflow survey half of the developer population started their careers within the last years which is to say half of all web developers have never known a world without React It s even highly likely that they were taught web development via React or that they have never built a site any other way They were told by their teachers then by recruiters and then by their employers that React was the way you build web sites and they invested their careers in it accordingly Beyond just React itself many frontend developers have also deeply enmeshed themselves into tools that are part of the React ecosystem It s not just their UI framework their entire toolchain may be built around React It s understandable that those of us who may have invested many years of practice with Swiss Army Knives okay JS mega stacks would be reticent to leave them behind ーthey re familiar they re comfortable even if we recognize their shortcomings and after all we spent all that time honing our skills with them Cole Peters Redefining Developer ExperienceAll this is to say that it is understandable how turning back now can feel like starting over While Alex Russell is not Steve Jobs this is not a dig I mean who is it makes sense to me why posts like this would be perceived as an existential threat We re telling them that everything I ve been taught since day one of their career and the skills that that they ve built are now considered harmful It hurts I know I ve been there Changing Directions is Difficult but Often Necessary “The most painful thing is losing yourself in the process of loving someone too much and forgetting that you are special too ーErnest HemingwayWhen you are deeply invested in a tool it can be difficult to see beyond it When a tool has been a part of your career since the beginning it can be difficult to imagine your career without it I didn t change willingly but it taught me some valuable lessons that I ve carried forward nonethless Don t wrap too much of your identity in a tool For example there s a difference between identifying as a web developer and a React developer In the latter case it can be easy to imagine your career and React are inherently interconected Recognize that your skills and expertise go beyond a specific tool you use to get the job done Every tool will eventually fade It may seem obvious in retrospect but less obvious in the moment that tools will come and go across your career In the cases of prominent tools they don t die just lose relevance Remember when jQuery was a critical resume skill It was far more widely used than React and while it still exists and is still actually widely used it increasingly less relevant as a career skill than it once was Flexibility is a valuable skill Yes it can be important to hone a particular skill in the short term but remaining flexible can be valuable over the long term It allows you to adjust to the ever shifting requirements of the job market Beyond that it can open you up to all kinds of possibilities and solutions that you might have otherwise miss which can make you more valuable in your current role and more efficient at the job you do Changing tools does not mean starting over It s true that you may have invested a lot of time and energy into a particular toolset but when you change directions you often find that you ve built a ton of skills that transcend it Looking back the early post Flash days on the web were a flurry of innovation brought by ex Flash Flex developers who brought their expertise to web standards development There were new animation libraries new frameworks and new tools that came from folks that were already familiar to those of us in the Flash and Flex community And ActionScript skills were definitely far less transferrable to the broader standards based web at the time than React skills are to non React development The last point I want to make is to those publishing and sharing the criticism of React I do agree that the debate is valuable and necessary but be aware of the impact of your criticism I know that Alex and others have made a point that this isn t intended as an attack on the developers who use React themselves but given the potential threat they might perceive to their current roles and their careers it is understandable why it might be seen as such regardless Recognize the difficulty of the course correction that you are advocating Make your case with empathy and reach out a hand to help them on that journey because whatever the future holds it s still a journey worth exploring 2023-03-01 16:33:37
海外TECH DEV Community Demos included with MiniBASIC https://dev.to/joestrout/demos-included-with-minibasic-8pf Demos included with MiniBASICThe recent announcement of MiniBASIC has been met with surprising and gratifying enthusiasm So I thought today I would go over the demos included with it You can find these by doing cd demo to change to the demo directory and then dir to list the files Note that in MiniBASIC unlike in MiniScript quotes are not require around file names that contain no punctuation but they re always accepted So cd demo would also work Here you find almost a dozen demos of various sizes plus GAME TXT which is a Silver Mountain save file ーmore on that later Let s take a quick look at each one Alien LettersTo launch the first demo enter load alienLetters followed by run This is a game I wrote when I was in middle school on an Apple I found it somehow still hanging around my hard drive made minor changes to convert the old sound routine which relied on poking a small machine language program into memory to MiniBASIC s SOUND command and threw it into the demo directory The game is a typing tutor as letters fall from the top of the screen you must press the corresponding letter to shoot them before they reach the ground The game gets harder over time by starting the letters closer to the ground The set of letters and how many fall at once are both set by line use list to list up to line LT ASDFJKL NL REM LETTERS USED NO OF LETTERS FALLING AT ONCECurrently it s set to the QWERTY home row keys three at a time You can retype this line or use edit to edit it if you want to change this ASCII TableDespite the name the asciiTable program displays not only ASCII characters code points but also code points This is a handy reference for values you can use with CHR n For example if you want to print the µ mu symbol you ll find this in the chart as so PRINT CHR will do it Keep in mind that MiniBASIC is not case sensitive and is a shortcut for PRINT so chr would work just as well This program also demonstrates combining graphics and text ーthe vertical lines are graphics done with the PLOT and LINE commands When the text scrolls the graphics do not which may be surprising when you first see it Use CLS to clear the screen BlackjackThis is another program from my youth It required no changes to get running in MiniBASIC However as I was inspecting the code I did notice a bug line read PRINT Shuffling FOR A TO FOR B TO CU A C NEXT NEXT This references CU A C when it should have been CU A B So I finally fixed this bug years later ColorsThe colors demo simply draws a color chart showing the built in color palette which is the same as the Commodore You can use these numeric values with the COLOR command For example COLOR will change both the text and the graphics drawing color to orange You can also use strings with arbitrary HTML colors whether they re part of the standard palette or not For example COLOR FFCCCC will get you a light pink Use COLOR to go back to the default green DrawingThe drawing program demonstrates the six drawing commands in MiniBASIC PLOT LINE RECT ELLIPSE POLY and IMAGE You just press the number of the one you want to see and then watch as it both shows the code and the result of using that command One thing this demo does not currently demonstrate is the PEN command which changes the line thickness of subsequent drawing Try adding PEN to see what that looks like LemonadeThis one is an in progress port of the original Lemonade Stand game from Apple circa This classic game was perhaps the first economic simulation game to reach the general public and was hugely popular It s still in progress because of two things It uses the Apple s low resolution graphics mode which doesn t port easily to MiniBASIC And it does it via some funky tricks like printing characters to the text screen which when lores graphics are turned on happen to form blocks of color Yikes It also uses a machine language routine to make music I have attempted to convert the parameters to this routine into the corresponding notes four our SOUND command but it s not quite right so the music is a bit out of tune So I will keep working on it Unless some kind and ambitious reader out there wants to help ーpull requests are gratefully accepted Silver MountainsilverMountain is the complete code from the Usborne book Mystery of Silver Mountain To get this code into MiniBASIC I first tried OCR optical character recognition but it didn t do very well So I ended up just typing it in line by line just like we would have done in the old days Then I spent a couple days debugging it also like we would have done in the old days But now I believe it to be complete and correct But I must warn you this is a hard game You will need to actually read the book and study the pictures for clues For example just because nothing on the screen says there is a pot doesn t mean you don t have to EXAMINE POT to find some critical item The pictures in the book are the only way you would know to do this I did make some minor enhancements to the original program I made it accept both lowercase and uppercase text and I added a few synonyms like LOOK for EXAMINE as well as a QUIT command You ll find my changes on lines and SoundsThe sounds program demonstrates usage of MiniBASIC s SOUND command Again you just press the key of the demo you want to run but in this case it just plays the sound The code for each demo is already on the screen The SOUND command takes four parameters frequency if gt or note if lt or array of sameduration in seconds volume or an array of values waveform By varying these parameters you can make a variety of interesting sounds all very much in character for the first wave of home computers SpirographThis is a very simple drawing demo using a little bit of SIN and COS to draw a many pointed star This demo and its code were featured in the original announcement Starstar is a neat little program I found over on a forum called BasicAll It draws an pointed star on the text screen It does this with surprisingly little code using TAB to position the cursor CLS FOR m TO FOR n m TO m PRINT TAB m n PRINT TAB n m PRINT TAB m n PRINT TAB n m NEXT n NEXT m VTAB END PrintFinally the tenPrint program is our version of the classic PRINT demo The core of this program is the line infinite loop PRINT CHR RND gt GOTO This is slightly different from the famous Commodore version because that uses the PETSCII character set which has diagonal lines at code points and We have to use slash and backslash which are at code points and But otherwise it s basically the same To break out of this infinite loop just press Control C Wrap upAnd that s it for the contents of the demo directory at least at the time of this writing I will probably add a few more as time goes on Do you have some cool BASIC code lying around or an idea for a new MiniBASIC program Let me know Maybe I ll include it as a demo with attribution of course in a future update to MiniBASIC 2023-03-01 16:21:01
海外TECH DEV Community Developing professional API with Azure Function Typescript + Boilerplate https://dev.to/safwanmasarik/developing-professional-api-with-azure-function-typescript-boilerplate-a88 Developing professional API with Azure Function Typescript BoilerplateThe article here is aimed to give details about framework workflow and libraries implemented for github repository Azure Function Node js Typescript Starter and Boilerplate at Highlights of this boilerplate ️Azure Function Typescript support ️Hot reload capability ーauto compile on save and server restartJest ーConfigured for unit testing mocking db responseLinq package ーan alternative to lodash Typescript support for enumerating collectionsMssql package ーsupport for local databaseJsonTypescript package ーModelling json object to Typescript objectJoiful package ーJoi for Typescript validate api parameters with class amp decorators Typescript project diagnostics enabled ーquickly catch error by compiling on background and displaying error in problems bar Auto format on saveBracket pair colorizer enabledVisual Studio code full support and intellisense Microservice architecture ーapi amp database separate repository no ORM Back End API TechnologyAzure FunctionsNode jsTypeScriptMicrosoft SQL ServerThe README file in the repository contains enough information for successfully running the project Let s get started Folder structure vscode contains extension recommendations debug launch settings build tasks and default IDE settings Note that IDE settings in workspace code workspace will override vscode settings Default folder structure for Azure Function Node js is maintained so the API functions must reside on the root directory Naming for the API functions is prefixed with az to make all the API functions sorted on top Examples of API naming based on the function type such as http timerTrigger or queueTrigger Shared folder contains the core layers such as services business logic data layer modelling and helpers Framework and workflowThe adopted framework follows a domain driven approach with separate layers for API service and data First entry point is the API layer which will call the service layer and receive the api response to be returned The service layer will perform business logic such as calculations and data formatting It also handles calling the data layer The data layer is only responsible to retrieve the data Data retrieval from database or rd party API should be conducted here Most JSON object will be converted to Typescript class object and the classes interface and enums are stored in models folder All classes and functions that are deemed as helpers is stored in helpers folder For unit testing only service layer and necessary helpers will be tested Unit testing should not do an actual call to the data layer therefore data responses must be mocked Data layer testing will be covered by integration test which will make actual api call and actual data retrieval from source Example of integration test with postman collection for CRUDE operation is available in folder postman AzFuncBoilerplate IntegrationTest postman collection json In this post we ll not cover for this content Libraries amp Tooling support JoifulRequest query or body parameters input s will have constraints hence need to be validated Here s how to do it Validation enforcement import as jf from joiful Get the request bodyconst params new ReqCreateUpdateDeleteShip params ship name req body ship name null params ship code req body ship code null Validate request bodyconst joiValidation jf validate params if joiValidation error return is valid false message joiValidation error message data null Declaring validation constraints at class import reflect metadata import as jf from joiful export class ReqCreateUpdateDeleteShip jf number optional allow null ship id number jf boolean optional is permanent delete boolean jf string required ship name string jf string regex a z a z kebab case kebab case going merry jackson required ship code string jf string email email string jf string creditCard credit card number string jsontypescriptResponses from the data layer comes in the form of JSON object jsontypescript maps JSON objects to an instance of a TypeScript class aka Deserialization Service layer will benefit having data layer response modelled as it provides consistent class and property for business logic and formatting Intellisense support Easy to change gt If data response property names changes class would not need to be changed because the library provide JsonProperty decorator which allows easy adjustment of JSON data mapping Deserialization import JsonConvert from jsontypescript let jsonConvert JsonConvert new JsonConvert const queryData object await data getShip params let modelledDbData DbShip jsonConvert deserializeArray queryData DbShip Class and property decorators For class properties to be visible to the mapper they must be initialized otherwise they are ignored They can be initialized using any valid value undefined or null import JsonObject JsonProperty from jsontypescript import DateConverter from helpers json converter JsonObject DbShip export class DbShip JsonProperty id Number true ship id number null JsonProperty name String true ship name string null JsonProperty code String true ship code string null JsonProperty is active Boolean true is active boolean null JsonProperty updated date DateConverter true updated date Date null Custom converter import JsonConvert JsonConverter JsonCustomConvert from jsontypescript let jsonConvert JsonConvert new JsonConvert JsonConverterexport class DateConverter implements JsonCustomConvert lt Date gt serialize date Date any return date getFullYear date getMonth date getDate deserialize date any Date return new Date date Convert JSON data into Typescript classUtilize online converter such as quicktype io View amp validate JSON dataUtilize online JSON data viewer and validator such as JSONGrid How to add new API endpointMake a copy of an api folder To make life easy delete the test folder inside the new folder Rename the new folder and copy the folder name Update the function json scriptFile value to the new folder name Now go index ts and update the function name to the folder name Your new API endpoint is ready Press F to run in debug mode and test it While in debug mode you can adjust the service layer that you want your api layer to call The changes is watched and will auto compile on save and server restart will happen automatically Please note that changing environments such that changing values in local settings json will require you to restart the server manually Final ThoughtsThank you for taking the time to read my first public technical article I am grateful to the wonderful developer community out there for nurturing me and now it s my turn to give back I ve enjoyed learning and sharing my experiences and I hope you find them helpful If you liked this article and you think this will help other s out there feel free to share it Comment if you feel something can be improved or added 2023-03-01 16:18:41
海外TECH DEV Community What's the biggest mistake you've ever made while coding? https://dev.to/michaeltharrington/whats-the-biggest-mistake-youve-ever-made-while-coding-12n2 What x s the biggest mistake you x ve ever made while coding I really enjoy reading posts where authors talk through a mistake that they have made and what they learned from it I find these posts to be really relatable and enjoyable to read It s nice to hear someone teach you something from a place of humility and when folks are talking about the lessons they ve learned from their own mistakes it really creates an empathetic approachable tone So with that in mind what s the biggest mistake you ve ever made while coding What problems did your mistake cause How did it happen And what did you learn from it 2023-03-01 16:17:44
海外TECH DEV Community Improving Website Performance with AWS CloudFront https://dev.to/blst-security/improving-website-performance-with-aws-cloudfront-ph Improving Website Performance with AWS CloudFrontA key component of the user experience is the website s performance Websites that take a long time to load may have higher bounce rates lower engagement and lower conversion rates Utilizing a content delivery network CDN like AWS CloudFront is one way to enhance the performance of websites Benefits of Using a CDNA CDN is a network of servers that are distributed around the world and used to deliver website content to end users By caching website content on these servers a CDN can improve website performance by reducing latency and delivering content faster AWS CloudFront is one such CDN that can help to boost website performance What is AWS CloudFront CloudFront is a service that speeds up the delivery of static and dynamic web content like HTML CSS JavaScript images and videos It is a global content delivery network CDN To reduce latency and boost website performance it distributes content through a global network of edge locations that are placed close to users Benefits of Using AWS CloudFrontImproved Website Speed CloudFront caches your website s content in edge locations reducing the time it takes to load content from your website This results in a faster website and a better user experience Increased Availability CloudFront can automatically route traffic to an alternate location if an edge location becomes unavailable This helps ensure that your website is always available to your users Reduced Server Load With CloudFront caching your website s content there s less traffic hitting your origin server This results in reduced server load and lower server costs Improved security AWS CloudFront provides features such as SSL TLS encryption DDoS protection and access control to improve the security of your website How to Set Up AWS CloudFrontSetting up AWS CloudFront is relatively straightforward Follow these steps to get started Enter CloudFront interface on AWS This step requires an AWS AccountCreate an AWS CloudFront distribution This involves specifying the origin of your content such as an Amazon S bucket or an Elastic load balancerConfigure your distribution This involves setting up features such as SSL TLS encryption access control and caching options Point your DNS records to AWS CloudFront Once your distribution is set up you need to point your DNS records to your AWS CloudFront distribution Best Practices for Optimizing PerformanceTo optimize the performance of your website with AWS CloudFront you can follow these best practices Use a custom domain name This can improve the user experience by providing a branded URL and allowing SSL TLS encryption Set appropriate cache control headers This can improve website performance by reducing the number of requests made to the origin server Minimize the use of cookies This can reduce the number of requests made to the origin server and improve website performance By using AWS CloudFront website owners can significantly improve website performance and provide a better user experience AWS CloudFront s content delivery network capabilities combined with its security and monitoring features make it an excellent choice for optimizing website performance If you re looking to improve your website s performance consider using AWS CloudFront Star our Github repoJoin the discussion in our Discord channelTest your API for free now at BLST 2023-03-01 16:01:05
Apple AppleInsider - Frontpage News Which iPhone colors are the most popular in 2023 https://appleinsider.com/articles/23/03/01/which-iphone-colors-are-the-most-popular-in-2023?utm_medium=rss Which iPhone colors are the most popular in Since its inception the iPhone has primarily been available in black and white but the iPhone saw a rise in the popularity of other colors A purple iPhone PlusIn a new report from Consumer Intelligence Research Partners CIRP a survey of iPhone users revealed that shades of black or white are no longer the top choices Instead iPhone preference has slowly begun to favor purple models Read more 2023-03-01 16:36:48
Apple AppleInsider - Frontpage News Meta leaks its AR four-year plan before Apple can beat them https://appleinsider.com/articles/23/03/01/meta-leaks-its-ar-four-year-plan-before-apple-can-beat-them?utm_medium=rss Meta leaks its AR four year plan before Apple can beat themMeta has made sure its new AR VR plans would leak as it tries to leverage its five year lead to establish itself as the headset company to beat ーbefore Apple makes its announcements Meta s Quest Pro headset launched to poor reviewsFacebook owner Meta has had an internal presentation about its AR VR plans and made certain to invite thousands of staff to guarantee every detail leaked quickly To add verisimilitude to the leak The Verge says Meta declined to comment on the roadmap presentation the publication received Read more 2023-03-01 16:16:56
Apple AppleInsider - Frontpage News A new Mac Pro is coming, confirms Apple exec https://appleinsider.com/articles/23/03/01/mac-pro-is-coming-confirms-apple-exec-but-when-is-the-question?utm_medium=rss A new Mac Pro is coming confirms Apple execApple hinting around the release of a Mac Pro continues with marketing chief Bob Borchers saying that bringing Apple Silicon to the whole Mac product line is a clear goal Rumors continue to come about a New Mac Pro but it s now eight months since the end of Apple s self imposed schedule to move all Macs to Apple Silicon While the rest of the range has moved to Apple Silicon we ve otherwise only had hints about the new Mac Pro Read more 2023-03-01 16:58:33
海外TECH Engadget Apple's M2 Mac mini falls to a new low of $549 https://www.engadget.com/apples-m2-mac-mini-falls-to-a-new-low-of-549-163447890.html?src=rss Apple x s M Mac mini falls to a new low of Last week Apple s new M Mac mini saw its first discount on Amazon but now it s dropped even further with a full off the list price at B amp H Photo The discount applies to the the GB mini M and the GB mini M both with GB of RAM bringing the tiny but mighty computers down to and respectively It looks like Amazon is matching the price on both the GB model and the larger GB configuration The Mac minis with the M Pro chip aren t seeing the same discount though Amazon is listing those below Apple s suggested price nbsp If you re looking for a powerful desktop computer you can pair up with any monitor you have on hand this is a great low cost way to get the power of Apple s new M chip In our review we gave the mini a solid score of praising the excellent performance and the still great squat aluminum design that disappears into your desk Around back you ve got plenty of ports to handle your accessories including two Thunderbolt UCB C ports an HDMI port with K output at Hz and K at Hz two USB A ports a mm headphone jack and a gigabit Ethernet port which you can upgrade to a gigabit port but it ll cost you an extra nbsp Inside there s the namesake M chip which Apple first first offered in The chip combines computing operations like CPU GPU input output interfaces and certain memory processes into one system on a chip allowing for faster processing speeds Apple has put the chip into new iPad Pros their latest MacBook Pros and now the Mac mini The chips in the discounted models have eight CPU cores graphics cores GB of RAM and either GB or GB of storage That GB of RAM may strain under heavy browser tab loads but should be suitable for most people s everyday work flows The minis also make a good home theater computer if you want even more customization than you d get with an Apple TV nbsp Follow EngadgetDeals on Twitter and subscribe to the Engadget Deals newsletter for the latest tech deals and buying advice This article originally appeared on Engadget at 2023-03-01 16:34:47
Cisco Cisco Blog Connecting industrial devices anywhere with Cisco’s new modules for LoRaWAN and 450MHz LTE https://feedpress.me/link/23532/15999748/connecting-industrial-devices-anywhere-with-ciscos-new-modules-for-lorawan-and-450mhz-lte Connecting industrial devices anywhere with Cisco s new modules for LoRaWAN and MHz LTEAt Mobile World Congress we announced two new network modules enabling the Cisco Catalyst IR Rugged Series Routers to connect industrial devices and sensors over an even wider range of wireless technologiesーunlocking new capabilities for our customers 2023-03-01 16:55:43
Cisco Cisco Blog Designing and Deploying Cisco AI Spoofing Detection – Part 1 https://feedpress.me/link/23532/15999718/designing-and-deploying-cisco-ai-spoofing-detection-part-1 Designing and Deploying Cisco AI Spoofing Detection Part Spoofed endpoints pretend something they are not opening up the network to attacks so Cisco developed AI Spoofing Detection to uncover compromised endpoints by modeling their normal behavior and alerting IT when abnormal actions are identified 2023-03-01 16:32:16
金融 金融庁ホームページ 株式会社三井住友銀行及び三井住友カード株式会社の産業競争力強化法に基づく事業適応計画の認定について公表しました。 https://www.fsa.go.jp/news/r4/ginkou/20230301.html 三井住友カード株式会社 2023-03-01 18:00:00
金融 金融庁ホームページ 第51回金融審議会総会・第39回金融分科会合同会合 議事次第を公表しました。 https://www.fsa.go.jp/singi/singi_kinyu/soukai/siryou/2023_0302.html 金融審議会 2023-03-01 17:00:00
金融 金融庁ホームページ 金融機関によるトランジション・ファイナンスを通じた脱炭素化支援を推進していくための官民の取組について課題提起ペーパーの英語版を公表しました。 https://www.fsa.go.jp/news/r4/singi/20230221.html 金融機関 2023-03-01 17:00:00
ニュース BBC News - Home Constance Marten arrest: Police fear baby has come to serious harm https://www.bbc.co.uk/news/uk-64808412?at_medium=RSS&at_campaign=KARANGA gross 2023-03-01 16:37:54
ニュース BBC News - Home Kaylea Titford: Parents who let neglected teen die jailed https://www.bbc.co.uk/news/uk-wales-64803863?at_medium=RSS&at_campaign=KARANGA jailedthe 2023-03-01 16:49:45
ニュース BBC News - Home Yorkshire cricket racism hearing: Tim Bresnan 'used racial slur' towards Azeem Rafiq's sister https://www.bbc.co.uk/sport/cricket/64814128?at_medium=RSS&at_campaign=KARANGA Yorkshire cricket racism hearing Tim Bresnan x used racial slur x towards Azeem Rafiq x s sisterFormer England bowler Tim Bresnan used a racial slur towards Azeem Rafiq s sister a hearing into allegations of racism at Yorkshire is told 2023-03-01 16:41:22

コメント

このブログの人気の投稿

投稿時間:2021-06-17 22:08:45 RSSフィード2021-06-17 22:00 分まとめ(2089件)

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

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