Skip to content

Code samples for mslearn-module-shifting-nodejs-express-apis-to-serverless

License

Notifications You must be signed in to change notification settings

MicrosoftDocs/mslearn-module-shifting-nodejs-express-apis-to-serverless

Repository files navigation

page_type name languages products
sample
Refactor Node.js Express APIs into serverless Azure Functions APIs
javascript, typescript
azure
vs-code
azure-functions

⚑Refactor Node.js Express APIs into serverless Azure Functions APIs

Open in GitHub Codespaces

Refactor Node.js APIs Azure Functions

This repository contains the source code for the Refactor Node.js Express APIs into serverless Azure Functions APIs module.

πŸ’« Overview

This project was created to help represent a fundamental app written with Node Express APIs and TypeScript that can be shifted to serverless functions with TypeScript.

The client-side (Front-end) app is Angular. However, it could just as easily be Vue or React. The vacation theme is used throughout the app.

by John Papa

πŸ”§ Technologies/Tools used

❓Why

I love Node.js and Express.js for creating APIs! These require a server and paying for that server in the cloud. Shifting to serverless alleviates the cost of server upkeep, helps scale up and down easily, and reduces the surface area of the middleware required for a robust Express app. Is it perfect? No, of course not! But this is a solid option if these factors affect you.

🎯 Prerequisites

Make a copy of the env.example file named .env, in the root of the project. It should contain the following code.

.env

NODE_ENV=development
PORT=7070
WWW=./

🏁 Getting Started

  1. Clone this repository

    git clone https://github.com/MicrosoftDocs/mslearn-module-shifting-nodejs-express-apis-to-serverless learn-functions
    cd learn-functions
  2. Install the npm packages

    npm install
  3. Build the Node.js, Express.js and the Angular code

    npm run full:build
  4. Run the app

    npm run node:start

🐞 Debug Node.js, Express.js and Angular

  1. Stop any debugging sessions that may be currently running

  2. Open proxy.conf.json and set the port to 7070

  3. Open the VS Code Command Palette F1

  4. Type View: Show Debug and press ENTER

  5. Select Debug Express and Angular

  6. Press F5

  7. Open the browser to http://localhost:4200

You may now set break points in the Express and Angular code.

🐞 Debug Functions and Angular

  1. Stop any debugging sessions that may be currently running

  2. Open proxy.conf.json and change the port to 7071

  3. Open the VS Code Command Palette F1

  4. Type View: Show Debug and press ENTER

  5. Select Debug Functions and Angular

  6. Press F5

  7. Open the browser to http://localhost:4200

You may now set break points in the Functions and Angular code.

πŸ›‘ Problems or Suggestions

Open an issue here

πŸ“š Important Resources

πŸ“š Debugging Resources

✍🏻 Next steps & Free Courses

Because learning is a never-ending journey, we want to help you as much as we can to get you ready for what's coming next. You'll find here a great collection of resources you can use to build your knowledge.

πŸ’» Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

βš–οΈLegal Notices

Microsoft and any contributors grant you a license to the Microsoft documentation and other content in this repository under the Creative Commons Attribution 4.0 International Public License, see the LICENSE file, and grant you a license to any code in the repository under the MIT License, see the LICENSE-CODE file.

Microsoft, Windows, Microsoft Azure and/or other Microsoft products and services referenced in the documentation may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries. The licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks. Microsoft's general trademark guidelines can be found at http://go.microsoft.com/fwlink/?LinkID=254653.

Privacy information can be found at https://privacy.microsoft.com/en-us/

Microsoft and any contributors reserve all other rights, whether under their respective copyrights, patents, or trademarks, whether by implication, estoppel or otherwise.

About

Code samples for mslearn-module-shifting-nodejs-express-apis-to-serverless

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published