Giter Site home page Giter Site logo

johnpapa / heroes-angular-serverless Goto Github PK

View Code? Open in Web Editor NEW
125.0 5.0 33.0 3.02 MB

TypeScript Node/Express 👉TypeScript Serverless ➕Angular

JavaScript 3.32% TypeScript 78.94% HTML 12.51% Shell 0.27% SCSS 4.95%
express nodejs typescript serverless azure-functions angular

heroes-angular-serverless's Introduction

Heroes Angular Serverless

TypeScript Node/Express 👉TypeScript Serverless ➕ Angular

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 app is Angular, however it could just as easily be Vue or React. The heroes and villains theme is used throughout the app.

by John Papa

Comparative client apps written with Vue and React can be found at at github.com/johnpapa/heroes-vue and github.com/johnpapa/heroes-react

Why

I love Node and Express for creating APIs! These require a server and paying for that server in the cloud. Shifting to serverless alleviates the cost, the 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

  1. We need a database. You can use the free Azure Cosmos DB trial. Or try the Azure Free Trial.
  2. Create an Azure Cosmos DB database.
  3. Create a container named heroes and another named villains. Give each a partition key of /id. You can add data through the app later.
  4. Make a copy of the env.example file named .env, in the root of the project. It should contain the following code. Replace the CORE_API_KEY and CORE_API_URL variables with your Azure Cosmos DB information.

.env

NODE_ENV=development
PORT=7070
WWW="./"
CORE_API_KEY="your-azure-cosmos-db-api-key-goes-here"
CORE_API_URL="https://papa-cosmos-api-db.documents.azure.com/?WT.mc_id=heroesangularserverless-github-jopapa"

Open the /functions/local.settings.json file and add the CORE_API_KEY and CORE_API_URL variables as shown below. Fill those values in with your database information.

/functions/local.settings.json

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "",
    "FUNCTIONS_WORKER_RUNTIME": "node",
    "CORE_API_KEY": "your-azure-cosmos-db-api-key-goes-here",
    "CORE_API_URL": "https://your-azure-cosmos-db-url-goes-here:443/"
  }
}

Getting Started

  1. Clone this repository

    git clone https://github.com/johnpapa/heroes-angular-serverless.git heroes
    cd heroes
  2. Install the npm packages

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

    npm run node-ng:build
  4. Run the app

    npm run node:start

Debug Node Express and Angular

  1. Open proxy.conf.json and change the port to 7070

  2. Open the VS Code Command Palette F1

  3. Type View: Show Debug and press ENTER

  4. Select Debug Express and Angular

  5. Press F5

  6. Open the browser to http://localhost:7070

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

Debug Functions and Angular

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

  2. Open the VS Code Command Palette F1

  3. Type View: Show Debug and press ENTER

  4. Select Debug Functions and Angular

  5. Press F5

  6. Open the browser to http://localhost:7071

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

Problems or Suggestions

Open an issue here

Resources

Debugging Resources

heroes-angular-serverless's People

Contributors

azureadvocatebit avatar johnpapa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

heroes-angular-serverless's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.