page_type | name | languages | products | ||||
---|---|---|---|---|---|---|---|
sample |
Refactor Node.js Express APIs into serverless Azure Functions APIs |
|
|
This repository contains the source code for the Refactor Node.js Express APIs into serverless Azure Functions APIs module.
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
- ✅ Visual Studio Code
- ✅ Node.js
- ✅ TypeScript
- ✅ Angular
- ✅ Express.js
- ✅ Azure Functions
- ✅ Azure Free Trial
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.
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=./
-
Clone this repository
git clone https://github.com/MicrosoftDocs/mslearn-module-shifting-nodejs-express-apis-to-serverless learn-functions cd learn-functions
-
Install the npm packages
npm install
-
Build the Node.js, Express.js and the Angular code
npm run full:build
-
Run the app
npm run node:start
-
Stop any debugging sessions that may be currently running
-
Open
proxy.conf.json
and set the port to7070
-
Open the VS Code Command Palette
F1
-
Type
View: Show Debug
and pressENTER
-
Select
Debug Express and Angular
-
Press
F5
-
Open the browser to http://localhost:4200
You may now set break points in the Express and Angular code.
-
Stop any debugging sessions that may be currently running
-
Open
proxy.conf.json
and change the port to7071
-
Open the VS Code Command Palette
F1
-
Type
View: Show Debug
and pressENTER
-
Select
Debug Functions and Angular
-
Press
F5
-
Open the browser to http://localhost:4200
You may now set break points in the Functions and Angular code.
-
✅ Documentation: Quickstart: Create a JavaScript function in Azure using Visual Studio Code
-
✅ Documentation: Quickstart: Create a JavaScript function in Azure from the command line
-
✅ Documentation: Quickstart: Create a function in Azure with TypeScript using Visual Studio Code
-
✅ Documentation: Quickstart: Create a TypeScript function in Azure from the command line
-
✅ Documentation: Deploy - Continuous delivery by using GitHub Actions
-
✅ Step by Step Guide: Migrating v3 to v4 programming model for Azure Functions for Node.Js Application
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.
-
✅ Build a Node.js app for Azure Cosmos DB in Visual Studio Code
-
✅ Expand query and transaction functionality in Azure Cosmos DB for NoSQL
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.
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.