投稿時間:2023-06-07 19:27:51 RSSフィード2023-06-07 19:00 分まとめ(31件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT 気になる、記になる… 米Apple、USJのマリオカートのアトラクション向けARヘッドセットの開発元を買収 https://taisy0.com/2023/06/07/172707.html apple 2023-06-07 09:12:12
IT ITmedia 総合記事一覧 [ITmedia ビジネスオンライン] パナの「フードプロセッサー」リコール 調理中に刃が欠ける恐れ https://www.itmedia.co.jp/business/articles/2306/07/news185.html itmedia 2023-06-07 18:20:00
IT ITmedia 総合記事一覧 [ITmedia News] 「エアコン我慢しないで」 5月の熱中症搬送者は一昨年の2.2倍、3割は住居で https://www.itmedia.co.jp/news/articles/2306/07/news182.html itmedia 2023-06-07 18:16:00
IT ITmedia 総合記事一覧 [ITmedia News] “AWSたまごっち”の裏側、AWS日本法人が公開 IoTサービスをフル活用 https://www.itmedia.co.jp/news/articles/2306/07/news181.html itmedia 2023-06-07 18:14:00
TECH Techable(テッカブル) 写真・SNS・ブログの情報をまとめて提示。デジタル名刺サービス「リットリンク∞カード」 https://techable.jp/archives/210429 tieups 2023-06-07 09:00:50
AWS AWS Machine Learning Blog Technology Innovation Institute trains the state-of-the-art Falcon LLM 40B foundation model on Amazon SageMaker https://aws.amazon.com/blogs/machine-learning/technology-innovation-institute-trains-the-state-of-the-art-falcon-llm-40b-foundation-model-on-amazon-sagemaker/ Technology Innovation Institute trains the state of the art Falcon LLM B foundation model on Amazon SageMakerThis blog post is co written with Dr Ebtesam Almazrouei Executive Director Acting Chief AI Researcher of the AI Cross Center Unit and Project Lead for LLM Projects at TII United Arab Emirate s UAE Technology Innovation Institute TII the applied research pillar of Abu Dhabi s Advanced Technology Research Council has launched Falcon LLM a foundational large language model … 2023-06-07 09:03:35
AWS AWS Government, Education, and Nonprofits Blog STEAM-empowered: AWS launches new skills and education programs to inspire cloud-curious students and empower girls, women across Virginia and beyond https://aws.amazon.com/blogs/publicsector/aws-launches-new-skills-education-programs-cloud-curious-students-girls-women-across-virginia-beyond/ STEAM empowered AWS launches new skills and education programs to inspire cloud curious students and empower girls women across Virginia and beyondAWS announced the launch of a new program and the expansion of a second to increase access to science technology engineering art and math STEAM educational programs and resources across Virginia and beyond These are the most recent AWS community impact efforts that aim to increase access to tech tools and training while reducing barriers to students who are underrepresented and underserved 2023-06-07 09:59:02
AWS AWS Japan Blog Amazon SageMaker Canvas の ML 予測を使用して Amazon QuickSight に予測ダッシュボードをパブリッシュ https://aws.amazon.com/jp/blogs/news/publish-predictive-dashboards-in-amazon-quicksight-using-ml-predictions-from-amazon-sagemaker-canvas/ AmazonSageMakerCanvasのML予測を使用してAmazonQuickSightに予測ダッシュボードをパブリッシュこの記事では、予測を明示的にダウンロードしてQuickSightにインポートしなくても、CanvasからMLベースの予測を使用してQuickSightで予測ダッシュボードを公開する方法を説明します。 2023-06-07 09:23:04
python Pythonタグが付けられた新着投稿 - Qiita Spotifyのプレイリストの楽曲データをChatGPT等で分析して、PPTを作成するツールを作ってみた。 https://qiita.com/katsuki_ono/items/3238cd325f0009ac7dfb Spotifyのプレイリストの楽曲データをChatGPT等で分析して、PPTを作成するツールを作ってみた。 2023-06-07 18:07:09
技術ブログ Mercari Engineering Blog Rust製TypeScriptコンパイラstcの現状と今後 https://engineering.mercari.com/blog/entry/20230606-b059cd98c3/ hellip 2023-06-07 10:00:08
海外TECH DEV Community Genesis of Tokenization in JavaScript https://dev.to/elliot_brenya/genesis-of-tokenization-in-javascript-3p0j Genesis of Tokenization in JavaScriptTokenization is a critical concept in programming that plays a significant role in various domains In the world of JavaScript tokenization holds immense importance In this article we will delve into the concept of tokenization explore its significance and provide practical examples using JavaScript code snippets We will take a unique approach to explain tokenization breaking down complex ideas into easily understandable concepts What is Tokenization Let assume you have a sentence written in a language that only a computer can understand Tokenization is the process of dissecting that sentence into smaller meaningful units called tokens These tokens serve as the fundamental building blocks of a programming language and carry specific meanings In simpler terms tokenization can be compared to breaking down a sentence into individual words where each word represents a token Significance of Tokenization Tokenization holds immense significance in the compilation process of programming languages It helps computers understand and interpret the code written by developers By breaking the code into tokens a language parser can efficiently analyze and process them Tokenization acts as a crucial preliminary step before parsing which converts tokens into a structured representation enabling accurate execution of instructions How is this Important to you as a Developer Enables syntax highlighting and improves code readability in editors Supports linting and code analysis tools for error detection and code improvement Helps in debugging by identifying and locating syntax errors Enables custom parsing and language extensions for specialized requirements JavaScript Tokenization JavaScript being a high level programming language relies heavily on tokenization When you write JavaScript code the JavaScript engine performs tokenization behind the scenes to parse and execute it Let s explore a few examples to understand tokenization in the context of JavaScript How to initiate Tokenization in JavaScript In JavaScript tokenization is automatically performed by the JavaScript engine during the parsing phase Developers do not need to explicitly initiate tokenization However understanding the process can help you grasp how the engine interprets your code Here s an example to illustrate the tokenization process var code var x var tokens code match b w b s g console log tokens In this code snippet we have a JavaScript code stored in the code variable To tokenize the code we use a regular expression b w b s g with the match method This regular expression matches either a word character b w b or any non whitespace character s effectively capturing each token The match method returns an array containing all the matched tokens which we store in the tokens variable Finally we output the tokens using console log When you run this code you will see the following output var x The code has been tokenized into individual elements representing the different parts of the code Each element in the resulting array represents a token such as keywords var identifiers x operators and punctuations Example Simple Mathematical ExpressionConsider the following JavaScript code snippet var a var b var sum a b console log sum This example depict JavaScript engine tokenizes Now let me breakdown the concept for youTokens var a Represents the declaration and assignment of the variable a var b Represents the declaration and assignment of the variable b var sum a b Represents the declaration and assignment of the variable sum by adding a and b console log sum Represents the console log statement to output the value of sum By breaking down the code into tokens the JavaScript engine can understand the purpose of each statement and perform the necessary operations Example Conditional Statement Let s consider a more complex code snippet involving a conditional statement var number if number console log The number is even else console log The number is odd When the JavaScript engine tokenizes this code it breaks it down into meaningful units called tokens Let s understand the tokens and their significance Tokenization Process var number This sequence of tokens represents the declaration and assignment of the variable number We assign the value to the number variable if number These tokens denote the beginning of a conditional statement The if keyword indicates that a condition is being checked The condition number checks if the number variable is divisible evenly by i e if it is an even number The opening curly brace marks the start of the block of code executed if the condition evaluates to true console log The number is even These tokens represent the log statement that will be executed if the condition evaluates to true The console log function is used to print the message The number is even to the console else These tokens signify the beginning of the block of code executed if the condition evaluates to false i e the number is odd The else keyword marks the start of this block and the opening curly brace denotes its beginning console log The number is odd These tokens represent the log statement that will be executed if the condition evaluates to false The console log function is used to print the message The number is odd to the console This token represents the closing curly brace which marks the end of the block of code executed if the condition evaluates to false Relevant Terms to Note Types of Tokens In JavaScript tokens can be categorized into different types such as identifiers keywords operators literals and punctuation symbols Here s an example that demonstrates various token types var x var message Hello World console log x console log message In this code snippet we can identify the following types of tokens Identifiers x message Keywords var console log Operators Literals Hello World Punctuation symbols Handling Strings and Delimiters Tokenization also involves recognizing strings and delimiters in the code Here s an example that demonstrates tokenizing a string and handling delimitersvar greeting Hello World console log greeting In this code snippet the tokenization process identifies the string Hello World as a single token while the semicolon acts as a delimiter indicating the end of the statement Tokenizing Expressions Tokenization is crucial for parsing and evaluating expressions in JavaScript Consider the following example that involves tokenizing and evaluating a simple mathematical expression var result console log result In this code snippet the expression is tokenized into the following tokens The JavaScript engine interprets and evaluates these tokens to compute the result Conclusion Tokenization plays a vital role in programming languages like JavaScript by breaking down code into tokens enabling accurate interpretation and execution By understanding the process of tokenization developers can gain a deeper comprehension of how their code is processed and enhance their ability to write efficient and effective programs 2023-06-07 09:48:47
海外TECH DEV Community Part : (3) Conditionals and Loops in JavaScript https://dev.to/cliff123tech/part-3-conditionals-and-loops-in-javascript-12j4 Part Conditionals and Loops in JavaScriptWelcome back to the third installment of our journey to mastering JavaScript I hope you ve been enjoying learning about this powerful language so far In our previous posts we covered the fundamentals of data types variables operators and expressions Thank you for your dedication to learning with me In this post we ll dive into the exciting world of conditionals and loops in JavaScript Let s continue our journey towards becoming JavaScript masters What are Conditionals and Loops in JavaScript Conditionals and loops are essential building blocks of programming and they are no different in JavaScript In this answer we ll take a closer look at how to use conditionals and loops in JavaScript What are Conditionals Conditionals are statements that check if a condition is true or false If the condition is true the code inside the conditional statement will be executed If the condition is false the code inside the conditional statement will not be executed Here s an example if condition code to be executed if condition is true if the condition is true the code inside the curly braces will be executed Conditional Statements in JavaScriptJavaScript provides two conditional statements if and switch These statements allow you to execute different actions based on different conditions Let s take a closer look at how they work The if StatementThe if statement executes a block of code if a specified condition is true Here s an example if statement examplelet age if age gt console log You are old enough to vote else console log You are not old enough to vote yet In this example we have a variable age that is set to The if statement checks if the value of age is greater than or equal to If it is it executes the code block inside the if statement and prints You are old enough to vote Otherwise it executes the code block inside the else statement and prints You are not old enough to vote yet Here are some more examples of using the if statement if statement with multiple conditionslet temperature if temperature gt console log It s too hot outside else if temperature lt console log It s too cold outside else console log The temperature is just right output The temperature is just right if statement with multiple conditionslet isRaining true if isRaining console log Remember to bring an umbrella output Remember to bring an umbrella The switch StatementThe switch statement allows you to execute different actions based on different conditions Here s an example Switch statement examplelet day Monday switch day case Monday console log Today is Monday break case Tuesday console log Today is Tuesday break case Wednesday console log Today is Wednesday break default console log Today is some other day In this example we have a variable day that is set to Monday The switch statement checks the value of day and executes the code block that matches the value In this case it prints Today is Monday Here are some more examples of using the switch statement Switch statement with multiple caseslet color red switch color case red console log The color is red break case green console log The color is green break case blue console log The color is blue break default console log The color is unknown output The color is red Switch statement with multiple caseslet fruit apple switch fruit case banana case apple console log The fruit is either a banana or an apple break case orange console log The fruit is an orange break default console log The fruit is unknown output The fruit is either a banana or an apple Loops in JavaScriptJavaScript provides three types of loops for while and do while Here s how they work The for LoopThe for loop is used to execute a block of code a number of times Here s an example for loop examplefor let i i lt i console log i In this example we have a variable i that is set to The for loop checks if the value of i is less than If it is it executes the code block inside the for loop and prints the value of i Then it increments the value of i by and checks the condition again This process repeats until the value of i is no longer less than The while LoopThe while loop loops through a block of code as long as a specified condition is true Here s an example do while loop examplelet i while i lt console log i i In this example we have a variable i that is set to The while loop checks if the value of i is less than If it is it executes the code block inside the while loop and prints the value of i Then it increments the value of i by and checks the condition again This process repeats until the value of i is no longer less than The do while LoopThe do while loop is a variant of the while loop This loop will execute the code block once before checking if the condition is true then it will repeat the loop as long as the condition is true Here s an example do while loop examplelet i do console log i i while i lt In this example we have a variable i that is set to The do while loop executes the code block inside the do while loop and prints the value of i Then it increments the value of i by and checks the condition If the condition is true the loop repeats This process repeats until the value of i is no longer less than Conclusion and Next StepsThank you for reading this section My goal is to help you become a master of JavaScript and I hope you ve learned a lot from it Remember to practice what you ve learned and keep building your skills We ve reached the end of this section but don t worry there s more to come In the next section we ll dive deeper into advanced topics Functions and more Stay tuned and keep learning You can find all the code been used in this section in the GithubGoodbye for now and happy coding Do not forget you can connect with me on linkedin 2023-06-07 09:44:54
海外TECH DEV Community Welcome Thread - v228 https://dev.to/devteam/welcome-thread-v228-3jal Welcome Thread vLeave a comment below to introduce yourself You can talk about what brought you here what you re learning or just a fun fact about yourself Reply to someone s comment either with a question or just a hello If you are new to coding want to help beginners in their programming journey or just want another awesome place to connect with fellow developers check out the CodeNewbie Org 2023-06-07 09:30:00
海外TECH DEV Community What is the Role of AI in DevOps? https://dev.to/kubi-ya/what-is-the-role-of-ai-in-devops-1p6b What is the Role of AI in DevOps Velocity and productivity are key for any engineering team small or large DevOps practices are key to enabling these metrics DevOps is about culture but it also requires the use of tools to become a reality DevOps ensures that all developers are working in harmony and provides best practices for delivering software efficiently There is a lot of talk in the software industry about AI ML usage and things have gotten pretty interesting since the induction of Large Language Models LLM and ChatGPT in particular into our lives In this article we will explore the practical use of AI in DevOps First let s discuss the evolution of DevOps and where the industry is heading towards from here Let s go The Evolution of DevOpsDevOps has come a long way and as a result we can see one or the other tool popping up every day The Emergence of DevOps The term “DevOps was coined in by a Belgian software developer Patrick Debois It emerged as a response to the growing need for improved collaboration between development and operations teams driven by the rise of agile methodologies and the demand for faster software delivery Cultural Shift and Automation There was still some confusion between Devs and the Ops folks with their tasks and even though the word DevOps was popping up here and there it wasn t used as a concrete methodology practice in organizations Hence during this phase the focus shifted from merely merging teams to fostering a cultural change emphasizing collaboration shared responsibility and continuous improvement Automation played a crucial role enabling organizations to automate repetitive tasks code deployment and infrastructure provisioning Tools like Puppet and Chef gained popularity streamlining configuration management Continuous Integration and Continuous Deployment Soon Continuous Integration CI and Continuous Deployment CD became an important theme for organizations especially for cloud practitioners as it helped them find bugs close to the development shorten the feedback loop and deploy faster than ever CI focused on regularly merging developer code changes into a shared repository and CD aimed at automating the release process to beat the time to market This is when tools such as Jenkins and Travis CI became popular enabling faster feedback loop and reducing time to market Containerization and Microservices The introduction of microservices enabled the splitting of the humongous monolith applications into smaller pieces to foster easy development collaboration and deployment To package these microservices container technologies pioneered by Docker became a game changer for DevOps Containers allowed developers to package applications with their dependencies enabling consistent deployment across different environments As a result microservices architecture gained traction promoting the development of loosely coupled independently deployable services Kubernetes emerged as a powerful orchestration tool for container management DevSecOps and Shift Left Security The broader usage of rd party libraries and APIs raised questions around security in their development pipeline This gave rise to security practices and made security every engineer s job Collectively this security approach was termed as DevSecOps Integrating security into the entire software development lifecycle became crucial emphasising “shift left security where security considerations were introduced early in the development process Security scanning tools such as Snyk and SonarQube gained prominence Cloud Native and Serverless Computing DevOps practices were booming and cloud native technologies such as Kubernetes emerged to solve the challenges of container management at scale Even though Kubernetes was introduced years ago the trend gained momentum only starting in Companies started ditching Docker Swarm and then using Kubernetes to handle the container orchestration part Organizations embraced cloud services leveraging the scalability and flexibility they offered As companies started migrating to the cloud the one thought that emerged was why they couldn t use the services only when required Serverless computing gained traction enabling developers to focus on writing code without worrying about the underlying infrastructure AWS Lambda and Azure Functions were popular serverless platforms AIOps and Observability present The increasing complexity of modern systems led to the rise of AIOps Artificial Intelligence for IT Operations and observability practices AIOps leveraged machine learning algorithms to automate problem detection analysis and resolution Observability focused on gaining insights into system behaviour through metrics logs and traces As a result tools like Prometheus Grafana and ELK stack Elasticsearch Logstash Kibana gained popularity The future DevOps AI Assistant and AI based Platform EngineeringThe complexity of DevOps with the introduction of Kubernetes Terraform Helm Charts and other tools led to increased overhead of DevOps teams on one hand while also increasing the developer dependency on DevOps on the other hand Organizations couldn t keep up with the talent debt while a major portion of existing DevOps resource time was focused on addressing developers requests enter the world of Developer Experience in Platform Engineering Also we can t ignore internal developer portals here as there is already a big buzz around this Platform engineering and internal developer platforms are indeed emerging as significant trends in the future of DevOps These approaches aim to streamline and enhance the software development process by providing developers with robust and scalable platforms that facilitate efficient and collaborative work In Gartner s Hype Cycle of two emerging trends that have gained significant attention are Generative AI and Causal AI Generative AI refers to the technology that enables machines to produce creative and original content Causal AI on the other hand focuses on understanding the cause and effect relationships within complex systems Both Generative AI and Causal AI represent promising advancements that hold the potential to reshape the way we create and understand information and systems in the future Platform engineering amp internal developer platforms IDPs aim to enrich developer experience through self service platforms that help develop deploy and operate software applications The main goal here is to provide your developers with consistent environments robust infrastructure and a standard automation workflow so that they can focus on writing code rather than doing everything themselves from the ground up A DevOps AI assistant is an invaluable approach emerging for overwhelmed software development and operations teams alike helping them easily automate the DevOps tasks such as CI CD code scan configuration management infrastructure provisioning monitoring using natural language and without the complexity of tooling By integrating with existing DevOps tools and platforms the virtual assistant can provide real time insights notifications recommendations and actions in a conversational way thus making DevOps and engineering platforms accessible to everyone and extending DevOps to the rest of the engineering organization This will improve developer velocity and level up their experience while reducing the organization s overhead cost and the need for additional headcount If all of this sounds too good to be true enter Kubiya Kubi Your DevOps AssistantThe emergence of Kubi Your New DevOps Assistant has created a significant buzz in the DevOps space offering a game changing solution for teams involved in software development and operations With its advanced capabilities Kubi leverages Large Language Models throughout its entire stack integrating conversational AI into its algorithms where it automates repetitive tasks provides actionable insights and facilitates seamless collaboration within DevOps teams In addition by integrating with existing DevOps tools and platforms Kubi streamlines processes such as code deployment testing monitoring knowledge retrieval and incident management enabling teams to focus on higher level strategic activities The introduction of Kubi marks a paradigm shift in the DevOps landscape where for the first time organizations can achieve greater efficiency agility innovation and SLAs in their software development lifecycle without needing to add headcount How Does Kubi Work Kubiya is a ChatGPT like experience for DevOps as it uses generative AI to create automated workflows that integrate with your Git CI Ks Cloud other engineering platforms and make them accessible to your users through a conversational AI over your existing chat tools while keeping permissions and TTL It uses proprietary large language models to converse with end users understand the context of their request and identify missing information to completely understand the required action It then uses pre build action stores wrapped inside of workflows to execute those actions while taking into account permissions Creating Extensive WorkflowsCreate extensive workflows in minutes and share them with your team to reuse and work Or you can get started with the already available workflow templates Kubi integrates with any API or SDK so therefore it s fully extensible to almost any DevOps tools out in the market making sure developers lives are easier than ever Extending the integration to other tools such as homegrown tools is easy by using a simple Python decorator Integration with any DevOps ToolsFor example here are some of the actions supported for AWS Workflow CustomizationsWorkflows can be easily customised or tested using their webapp if you want to put proper guardrails and filter our certain data from your end users Managing Workflows in a Declarative FormatYou can also manage your workflows through YAML Security is Taken CareYou can easily manage permissions and RBAC so only authorised personnel can have the ability to create and modify the workflows This way your security concerns are taken care of easily Knowledge Management Q amp A EngineBut Kubiya can go beyond just actions It can learn from your docs and answer “How do i… questions based on your Confluence Notion Gitbook or any other markdown resourceRepetitive and mundane tasks in DevOps can be daunting and can drain the energy out of your developers It is time to say goodbye to those complex configuration tools that add a burden to your engineering team Kubi helps you manage your developers and DevOps engineers time so they can do more in less time Why Should Software Organizations Use Kubiya DevOps self service powered by an AI assistant like Kubiya offers several notable advantages as a peak into the future of software development and operations Zero learning curve to adopt Work Smarter not Harder for organizations to truly adopt a scalable DevOps practice the end user experience needs to be prioritized In today s LLM obsessed world it s been almost universally accepted that this begins and ends with the presence of ConversationalAI Flexible and easy to maintain workflows Why limit yourself to the boundaries of rigid rule based workflows when you operate with prompt based dynamic ones Prompting your intent into Kubiya will generate a predictable techstack aware and permission aware workflow less workflows Increased Efficiency eliminate context switching and improve upon DevOps self service without sacrificing critical time to market By leveraging AI assistant tools like Kubiya tasks such as code deployment testing and monitoring can be streamlined and performed more efficiently by extend actionable insights and workflows i real time and bypassing the ticket queue Enhanced Collaboration Kubiya acts as a virtual teammate assisting DevOps teams throughout the software development lifecycle It promotes stronger teamwork by fostering better communication and knowledge sharing Continuous Delivery and Integration Kubiya can help automate continuous integration and delivery CI CD pipelines It can handle tasks such as code merging unit testing and automated deployments ensuring a smooth and reliable release process This enables organizations to deliver software updates rapidly and frequently supporting agile development practices Intelligent Automation Kubiya leverages LLMs as a means to gain user intent and gather the necessary context to extend actionable workflows complete with reinforcement learning that helps fine tune the AI assistant response and serves a more personalised recommendation the next time around These techniques enables users to understand and respond to user queries automate repetitive tasks and provide intelligent recommendations Through intelligent automation DevOps self service becomes more intuitive reduces manual effort and increases productivity Continuous Monitoring and Analysis Kubiya integrated into DevOps self service workflows can continuously monitor systems and applications providing real time insights and alerts It can analyze logs metrics and other monitoring data identifying potential issues or performance bottlenecks By proactively detecting and addressing problems DevOps teams can maintain high system availability and performance Level Up Non Technical Users Kubiya empowers non technical users to interact with the development process more effectively It can guide users through complex tasks offer recommendations and automate repetitive processes This democratization of DevOps functions allows stakeholders from various roles and departments to participate actively in the software development lifecycle Knowledge Capture and Retention Democratize access to knowledge with Kubiya by capturing and retaining knowledge from interactions with DevOps teams internal docs data sources eg Jira ServiceNow etc and user interactions By continuously learning from knowledge sources operator inputs and end user responses the assistant becomes more intelligent and efficient over time This knowledge can be shared across the organization ensuring continuity and reducing dependency on specific individuals Why wait when you can automate your DevOps today Try Kubiya for FREE 2023-06-07 09:09:22
海外TECH DEV Community TypeScript Express: Building Robust APIs with Node.js https://dev.to/wizdomtek/typescript-express-building-robust-apis-with-nodejs-1fln TypeScript Express Building Robust APIs with Node jsIn today s fast paced world of web development building robust and scalable APIs is crucial for any application Node js has become a popular choice for backend development due to its non blocking event driven architecture and the vast ecosystem of libraries and frameworks available One such framework is Express which simplifies the process of building web applications and APIs with Node js TypeScript a statically typed superset of JavaScript has gained traction among developers for its ability to catch errors during development and provide better tooling and autocompletion In this blog post we will explore how to build a robust API using TypeScript and Express taking advantage of the benefits that TypeScript brings to the table Setting Up a TypeScript Express ProjectTo start building an Express API with TypeScript you ll need to set up your development environment Follow these steps Install Node js and npm If you haven t already download and install Node js from the official website npm Node Package Manager comes bundled with Node js so once you have Node js installed you ll also have npm Create a new directory for your project Open your terminal or command prompt and navigate to the directory where you want to create your project You can use the mkdir command to create a new directory For example mkdir my express apiNavigate to the project directory Use the cd command to navigate into the newly created directory cd my express apiInitialize a new Node js project To initialize a new Node js project run the following command in your terminal npm initThis command will prompt you to provide information about your project such as the name version description entry point etc You can press enter to accept the default values or provide your own Install the necessary dependencies With your project initialized you need to install the required dependencies In this case you ll need Express TypeScript ts node and the TypeScript declarations for Express Run the following command in your terminal to install these dependencies npm install express typescript ts node types node types express save devThis command will download and install the specified packages and save them as devDependencies in your package json file Express A minimal and flexible web application framework for Node js TypeScript A superset of JavaScript that adds static typing and advanced language features ts node A TypeScript execution environment for Node js types express TypeScript declaration files for Express The save dev flag ensures that these dependencies are saved as devDependencies as they are only required during the development process Configuring TypeScript Create a tsconfig json file in the root directory of your project This file specifies the TypeScript configuration compilerOptions target es module commonjs outDir dist strict true esModuleInterop true skipLibCheck true forceConsistentCasingInFileNames true include src ts exclude node modules This configuration specifies the output directory module system and other options for the TypeScript compiler Create a new folder named src and inside it create an index ts file This will be the entry point of your application Once the installation is complete you re ready to start building your TypeScript Express API You can now proceed to create your TypeScript files and configure the Express application Note It s a good practice to create a gitignore file in your project directory to exclude unnecessary files from version control Add node modules to the gitignore file to prevent it from being tracked by Git Building an Express API with TypeScriptNow that the project is set up let s build a simple Express API with TypeScript Import the necessary dependencies in index ts import express Request Response from express const app express const port process env PORT Define a route app get req Request res Response gt res send Hello TypeScript Express Start the server app listen port gt console log Server running at http localhost port This code sets up a basic Express server that listens on port and responds with a greeting when the root path is accessed Adding scripts to package jsonAdd the following scripts to your package json file scripts start ts node src index ts build tsc serve node dist index js These scripts allow you to start the development server build the TypeScript files and serve the compiled JavaScript files You can now start your application by running npm startVisit http localhost in your browser and you should see the message Hello TypeScript Express Creating a Simple CRUD APINow that our basic server is set up we can start building the API Let create a simple CRUD Create Read Update Delete API for managing a list of tasks Defining the Task modelCreate a models directory inside src and add a task ts file with the following code export interface Task id number title string description string completed boolean This interface defines the structure of a Task object Implementing the Task APICreate a routes directory inside src and add a tasks ts file with the following code import Router Request Response from express import Task from models task const router Router let tasks Task Add your CRUD API implementation hereexport default router Implementing CRUD operationsNow that we have our basic Task API set up let s implement the CRUD operations Create a task Add the following code to the tasks ts file to create a new task router post req Request res Response gt const task Task id tasks length title req body title description req body description completed false tasks push task res status json task This code creates a new task with a unique ID and adds it to the tasks array Read all tasks Add the following code to the tasks ts file to retrieve all tasks router get req Request res Response gt res json tasks Read a single task Add the following code to the tasks ts file to retrieve a specific task by ID router get id req Request res Response gt const task tasks find t gt t id parseInt req params id if task res status send Task not found else res json task This code searches for a task with the specified ID and returns it if found or a error if not found Update a task Add the following code to the tasks ts file to update a specific task by ID router put id req Request res Response gt const task tasks find t gt t id parseInt req params id if task res status send Task not found else task title req body title task title task description req body description task description task completed req body completed task completed res json task This code updates the specified task with the new values provided in the request body Delete a task Add the following code to the tasks ts file to delete a specific task by ID router delete id req Request res Response gt const index tasks findIndex t gt t id parseInt req params id if index res status send Task not found else tasks splice index res status send This code removes the specified task from the tasks array Integrating the Task API with the Express serverFinally let s integrate the Task API with our Express server Update the index ts file with the following changes import express Request Response from express import taskRoutes from routes tasks const app express const port process env PORT app use express json Add this line to enable JSON parsing in the request bodyapp use tasks taskRoutes Add this line to mount the Task API routesapp get req Request res Response gt res send Hello TypeScript Express app listen port gt console log Server running at http localhost port Now our Task API is fully integrated with the Express server and we can perform CRUD operations on tasks Adding validation and error handlingTo further improve our API let s add validation and error handling to ensure that the data we receive from clients is valid and that we provide meaningful error messages Installing validation libraries First install the express validator and its type definitions npm install express validator types express validatorAdding validation to the Task API Update the tasks ts file to include validation for the task creation and update endpoints import Router Request Response from express import body validationResult from express validator import Task from models task const router Router let tasks Task const taskValidationRules body title notEmpty withMessage Title is required body description notEmpty withMessage Description is required body completed isBoolean withMessage Completed must be a boolean router post taskValidationRules req Request res Response gt const errors validationResult req if errors isEmpty return res status json errors errors array const task Task id tasks length title req body title description req body description completed false tasks push task res status json task router put id taskValidationRules req Request res Response gt const errors validationResult req if errors isEmpty return res status json errors errors array const task tasks find t gt t id parseInt req params id if task res status send Task not found else task title req body title task title task description req body description task description task completed req body completed task completed res json task rest of the CRUD operations export default router These changes add validation rules for the title description and completed fields and return a Bad Request response with error messages if the validation fails Adding error handling middleware To handle errors in a more centralized way let s add an error handling middleware to our Express server Update the index ts file with the following changes import express Request Response NextFunction from express import taskRoutes from routes tasks const app express const port process env PORT app use express json app use tasks taskRoutes app get req Request res Response gt res send Hello TypeScript Express Add this error handling middlewareapp use err Error req Request res Response next NextFunction gt console error err stack res status send Something went wrong app listen port gt console log Server running at http localhost port This middleware will catch any unhandled errors and return a Internal Server Error response ConclusionIn this blog post we have built a robust API using TypeScript and Express by implementing CRUD operations for a Task model Keep exploring and expanding your API to include even more advanced features such as authentication rate limiting and caching Happy coding 2023-06-07 09:01:29
海外TECH Engadget Samsung's 1TB 980 Pro SSD falls to a new all-time low https://www.engadget.com/samsungs-1tb-980-pro-ssd-falls-to-a-new-all-time-low-092513900.html?src=rss Samsung x s TB Pro SSD falls to a new all time lowIf you re in the market for some serious storage add ons now might be your chance Samsung s TB Pro SSD is down to a new all time low Its counterpart the Pro SSD with Heatsink is also at the best price we ve seen yet at nbsp Samsung s Pro SSD supports read speeds up to MB S comes as a compact M form factor and uses a special thermal control algorithm to control heat levels with extended use The SSD also includes Samsung Magician so you can monitor its health over time and includes a two month membership to Adobe Creative Cloud Photography with your purchase nbsp If you re a PS owner looking to upgrade the heatsink will offer better performance and reliability Heatsink keeps the device from overheating and performance dropping on the PS or your PC by dispersing heat as it occurs nbsp If you prefer Western Digital s storage options its WD Black SNX SSD is still part of a big sale with a percent discount bringing the TB model from to The smaller memory options also have significant price cuts with the TB option down to from and the TB down to from nbsp nbsp This article originally appeared on Engadget at 2023-06-07 09:25:13
海外TECH CodeProject Latest Articles HTML5 Event Calendar/Scheduler https://www.codeproject.com/Articles/732679/HTML-Event-Calendar-Scheduler calendar 2023-06-07 09:59:00
海外科学 NYT > Science Air Quality This Week Gives U.S. a Glimpse of the World’s Air Pollution https://www.nytimes.com/2023/06/07/us/air-quality-pollution-worldwide.html Air Quality This Week Gives U S a Glimpse of the World s Air PollutionAir quality readings like the ones expected across parts of New York State on Wednesday would not be seen as particular cause for alarm in some parts of the world 2023-06-07 09:47:10
ニュース BBC News - Home Pope Francis, 86, to have abdominal surgery https://www.bbc.co.uk/news/world-europe-65821047?at_medium=RSS&at_campaign=KARANGA health 2023-06-07 09:07:05
ニュース BBC News - Home Boy, 14, dies after 'isolated incident' at school https://www.bbc.co.uk/news/uk-scotland-edinburgh-east-fife-65831563?at_medium=RSS&at_campaign=KARANGA lothian 2023-06-07 09:54:16
ニュース BBC News - Home Birmingham the luckiest place for Lottery players https://www.bbc.co.uk/news/uk-england-birmingham-65830686?at_medium=RSS&at_campaign=KARANGA holders 2023-06-07 09:26:26
ニュース BBC News - Home Dementia patient failed by safeguarding system in Northern Ireland https://www.bbc.co.uk/news/uk-northern-ireland-65701486?at_medium=RSS&at_campaign=KARANGA stanley 2023-06-07 09:50:42
ニュース BBC News - Home PGA Tour, LIV Golf & DP World Tour merger: Calls for Jay Monahan to resign in 'heated' players meeting https://www.bbc.co.uk/sport/golf/65830431?at_medium=RSS&at_campaign=KARANGA PGA Tour LIV Golf amp DP World Tour merger Calls for Jay Monahan to resign in x heated x players meetingPlayers call for PGA Tour chief Jay Monahan to resign in a heated meeting following its shock merger with the DP World Tour and LIV Golf 2023-06-07 09:52:17
ニュース BBC News - Home What do we know about the incident? https://www.bbc.co.uk/news/world-europe-65818705?at_medium=RSS&at_campaign=KARANGA major 2023-06-07 09:13:43
ニュース Newsweek 15歳の女性サーファー、サメに襲われ6針縫う大けがを負う...足には生々しい傷跡 https://www.newsweekjapan.jp/stories/world/2023/06/156-1.php 2023-06-07 18:50:00
IT 週刊アスキー 【実機体験】Apple Vision Proはメガネユーザーも裸眼のまま快適 https://weekly.ascii.jp/elem/000/004/140/4140034/ applevisionpro 2023-06-07 18:20:00
IT 週刊アスキー シナモロール・クロミとコラボしたネッククーラーを限定販売へ、サンコー「20周年感謝祭」 https://weekly.ascii.jp/elem/000/004/139/4139987/ 限定販売 2023-06-07 18:30:00
IT 週刊アスキー Mac版『DEATH STRANDING DIRECTOR’S CUT』が発売決定! https://weekly.ascii.jp/elem/000/004/140/4140022/ eathstrandingdirectorscut 2023-06-07 18:10:00
IT 週刊アスキー シャープ、写真家・安珠氏が「AQUOS R8 pro」で撮影した作品集を公開 https://weekly.ascii.jp/elem/000/004/139/4139998/ aquos 2023-06-07 18:15:00
IT 週刊アスキー お気に入りのキャラといつでもおでかけ! 「おでかけAR」バーチャルキャストと連携 https://weekly.ascii.jp/elem/000/004/140/4140004/ 運営 2023-06-07 18:15:00
海外TECH reddit I made the mistake of opening the door to JWs. https://www.reddit.com/r/japanlife/comments/1438ade/i_made_the_mistake_of_opening_the_door_to_jws/ 2023-06-07 09:20:51

コメント

このブログの人気の投稿

投稿時間: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件)