npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

js-e2e-express-mongo

v1.0.0

Published

JavaScript server written with Express.js and the native MongoDB API

Downloads

4

Readme


page_type: sample languages:

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

Archived repo - replacement available

This repo has been replaced with a seaparte repo: https://github.com/Azure-Samples/js-e2e-express-mongodb. Both can be deployed to Azure App Service.

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

Express.js website, with SSR React, connecting to a MongoDB. Deploy to Azure to use:

  • Azure App Service
  • Azure Cosmos DB (MongoDB API)

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.

Version: Environment Variables

Version: Key Vault

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

Looking for more Azure JavaScript code?