GithubHelp home page GithubHelp logo

isabella232 / js-e2e-express-mongo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from azure-samples/js-e2e-express-mongodb

0.0 0.0 0.0 109 KB

The sample code is a JavaScript server written with Express.js and the native MongoDB API.

License: MIT License

Dockerfile 16.38% JavaScript 82.87% Shell 0.75%

js-e2e-express-mongo's Introduction

page_type languages name description products
sample
javascript
nodejs
JavaScript end-to-end - deploy Express.js MongoDB app to App Service from Visual Studio Code
Deploy the Express.js application which connects to MongoDB to Azure App Service (on Linux) and a CosmosDB.
azure
vs-code
azure-app-service
azure-cosmos-db

JavaScript end-to-end Express.js app with a MongoDB database

For a complete tutorial, please use the Microsoft Documentation tutorial found here.

The sample code is a JavaScript server written with Express.js and the native MongoDB API. The user adds data ( 2 text fields), can view data, and delete a single row or all rows.

The programming work is done for you, this tutorial focuses on using the local and remote Azure environments successfully from inside Visual Studio Code with Azure extensions.

The tutorial demonstrates how to load and run the project locally with VSCode, using extensions, was well as how to run the code remotely on an App service. The tutorial includes creating a CosmosDB resource for the Mongo API, getting the connection information and setting that in the app service configuration setting to connect to a cloud database.

Sample application

The Node.js app consists of the following elements:

  • Express.js server hosted on port 8080
  • Simple React.js server-side view engine
  • MongoDB native API functions to insert, delete, and find data

Features

This project framework provides the following features:

  • Create Azure app resource
    • Create web app resource
    • Deploy Express.js app to web app resource
    • Set app configuration settings
  • Create CosmosDB resource
    • Create database resource for use with MongoDB API
    • Get connection string

Getting Started

  1. Clone or download repo.
  2. Follow tutorial to create resources with Visual Studio Code extensions.
    • Create web app resource, to host Express.js app
    • Create CosmosDB resource, to host MongoDB database

Create or use existing Azure Subscription

Install software

  • Node.js and npm, the Node.js package manager installed to your local machine.
  • Docker - Docker is used to provide a local MongoDB database without having to install MongoDB.
    • If you need to use Docker to get a local MongoDB database, you also need to use:
    • If you already have a local MongoDB, and don't want to install Docker, you can still this step. Any steps using the Development Container to access a locally running MongoDB can be repurposed to use your own local MongoDB as long as the following MongoDB URL is available:
      • mongodb://localhost:27017
  • Visual Studio Code installed to your local machine.
  • Visual Studio Code extensions:

Installation

  1. Install the sample's dependencies:

     npm install
  2. Run the command to run the web app.

    npm start
  3. Open a web browser and use the following url to view the web app on your local computer.

    http://localhost:8080/

Tests

The integration request depends on a real database connection, either locally or remotely.

  • Integration test file: test/data-integration.test.js

js-e2e-express-mongo's People

Contributors

diberry avatar microsoft-github-operations[bot] avatar microsoftopensource avatar

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.