Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Static Web Apps - Mongoose starter

This project is designed to be a starter creating sites using Azure Static Web Apps, with Azure Cosmos DB API for Mongo DB as a database and a Mongoose client. It's built with the following:

Azure deployment

Please refer to the documentation for information on creating the appropriate server resources and deploying the project.

Local development

You can run the project locally as well by following the local setup instructions.

Project structure

This starter project is heavily commented and designed to be both a template and learning tool. The key files you'll want to be aware of:

package.json

At the root of the project is package.json, which consists of a dev script for starting the server, and references to both Vite and Azure Static Web Apps CLI to enable running the project locally.

vite.config

Configuration file for Vite, which instructs the service to use public as the root for the client.

public

Root folder for the client and index.html, style.css and script.js. script.js contains the code to interact with the server and is heavily commented.

api

Root folder for Azure Functions. All new serverless functions are added to this directory.

api/store.js

The data store for the project. Contains one Mongoose model for TaskModel, methods for interacting with the database, and logic to start the MongoDB Memory Server if no connection string is provided.

NOTE: Note the environment variable of CONNECTION_STRING. This must be set for the application to use an external database.

api/tasks/index.js

The code for Azure Functions is placed in a folder for each function and named index.js. It contains the code to get the current user information and use connect to the database and perform the operation.

About

A starter application using mongoose

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages