A Cosmos DB, Express.js, Vue, and Node.js app
This project framework provides the following features:
- Vue.js
- Node.js
- Express
- Mongoose API
- Connecting to MongoDB or CosmosDB
- Building, Debugging, Deploying with Docker
Node.js with npm
git clone https://github.com/johnpapa/vue-heroes.git
cd vue-heroes
npm install
-
Configure Cosmos DB server settings
Rename the
example-environment.js
file toenvironment.js
in theserver/env/
folder and update it with your Cosmos DB settings. Replace the account, database name, key, and port with your specific configuration.// server/env/environment.js module.exports = { accountName: 'your-cosmosdb-account-name-goes-here', databaseName: 'your-cosmosdb-database-name-goes-here', key: 'your-key-goes-here', port: 10255 };
This will build the app and run the dev server for Vue and WebPack. The Node express server will launch and WebPack will proxy the calls from the browser to the API in express. It will also and prepare it for local debugging.
# build for production with minification
npm run build
# serve on http://localhost:8080
# and run the api on http://localhost:3001
npm run debug
This will build the app and launch via the Node.js express server.
# build for production with minification
npm run build
# run the node server
npm start
Build the image and run container.
npm run docker-up
Build the image and run container for local debugging.
npm run docker-up-debug