惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
N
Netflix TechBlog - Medium
WordPress大学
WordPress大学
云风的 BLOG
云风的 BLOG
J
Java Code Geeks
V
Visual Studio Blog
H
Help Net Security
Engineering at Meta
Engineering at Meta
Hugging Face - Blog
Hugging Face - Blog
Microsoft Security Blog
Microsoft Security Blog
腾讯CDC
博客园 - 【当耐特】
B
Blog
Stack Overflow Blog
Stack Overflow Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
大猫的无限游戏
大猫的无限游戏
GbyAI
GbyAI
博客园 - 司徒正美
博客园 - 叶小钗
Y
Y Combinator Blog
MyScale Blog
MyScale Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
G
Google Developers Blog
酷 壳 – CoolShell
酷 壳 – CoolShell

The latest on application development - The GitHub Blog

Dungeons & Desktops: 10 roguelikes that never die (because their communities won’t let them) Dungeons & Desktops: Building a procedurally generated roguelike with GitHub Copilot CLI Agent-driven development in Copilot Applied Science Building AI-powered GitHub issue triage with the Copilot SDK Context windows, Plan agent, and TDD: What I learned building a countdown app with GitHub Copilot GitHub Issues search now supports nested queries and boolean operators: Here's how we (re)built it How GitHub engineers learn new codebases How we built the GitHub Skyline CLI extension using GitHub Build code security skills with the GitHub Secure Code Game
Insider newsletter digest: Cook up a controller with GitH...
Sara Verdi · 2024-02-23 · via The latest on application development - The GitHub Blog

This is abridged content from September 2023’s Insider newsletter. Like what you see? Sign up for the newsletter to receive complete, unabridged content in your inbox twice a month Sign up now >

Whether you’re a software architect, QA engineer, technical lead, or any other type of developer, you’ll most likely benefit from building a controller function in Node.js. A controller function is a specific piece of code within an application’s architecture—often found in the Model-View-Controller (MVC) pattern—that facilitates communication between the user and the underlying application logic.

Think of the controller function as the master chef in your code kitchen 🔥👨‍🍳. It takes in your ingredients (user input), works its culinary magic behind the scenes by interacting with the data model, and serves up a deliciously updated UI 🍽️. So, whether you’re coding up a storm or cooking up code, the controller function is your secret sauce to a flavorful application.

And here’s a little extra food for thought: did you know that you can build a controller on the fly with GitHub Copilot?

Follow this recipe to cook up your own controller function in Node.js with our new AI-pair programming tool:

  1. Install the GitHub Copilot extension
  2. Set up a new Node.js project and add instructions for GitHub Copilot.
  3. Define your controller function specifications.
  4. Leverage GitHub Copilot’s suggestions.
  5. Accept and implement the code recommendations by pressing TAB and ENTER.
  6. Add the required function details.
  7. Optimize error handling.
  8. Return API response.
  9. Review and validate the code.
  10. Update code to match your specific requirements.

One of our very own developer advocates, @LadyKerr, used this exact recipe to help concoct a GPT-3 application with GitHub Copilot that finds the nutritional content of any recipe with AI 🍜. You can find the source code and build it yourself here.

Or, if you’re a more visual learner, you can click through to follow the steps in this video:

Click on the image above to learn how to create a controller with GitHub Copilot.

Ready to whip up a controller function of your own? Let’s get cookin’ 🍴! Sign up for GitHub Copilot.

Want to receive content like this twice a month, right in your inbox? Sign up for the newsletter now >

Written by

Sara Verdi

Related posts

Explore more from GitHub

Docs

Docs

Everything you need to master GitHub, all in one place.

Go to Docs

GitHub

GitHub

Build what’s next on GitHub, the place for anyone from anywhere to build anything.

Start building

Customer stories

Customer stories

Meet the companies and engineering teams that build with GitHub.

Learn more

The GitHub Podcast

The GitHub Podcast

Catch up on the GitHub podcast, a show dedicated to the topics, trends, stories and culture in and around the open source developer community on GitHub.

Listen now