This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Specifies the Unity configuration for the main container. | |
/// </summary> | |
public static class UnityConfig | |
{ | |
private static Lazy<IUnityContainer> container = | |
new Lazy<IUnityContainer>(() => | |
{ | |
var container = new UnityContainer(); | |
RegisterTypes(container); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mongoose = require('mongoose'); | |
/** | |
* Set to Node.js native promises | |
* Per http://mongoosejs.com/docs/promises.html | |
*/ | |
mongoose.Promise = global.Promise; | |
// Cosmos DB Connection String | |
// eslint-disable-next-line max-len | |
const mongoUri = `mongodb://${process.env.COSMOSDB_ACCOUNT}:${process.env.COSMOSDB_KEY}@${ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mongoose = require('mongoose'); | |
const Schema = mongoose.Schema; | |
const todoSchema = new Schema( | |
{ | |
id: { type: Number, required: true, unique: true }, | |
name: String, | |
saying: String | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ToDo = require('./todo.model'); | |
const ReadPreference = require('mongodb').ReadPreference; | |
require('./mongo').connect(); | |
function getToDoes(req, res) { | |
const docquery = ToDo.find({}).read(ReadPreference.NEAREST); | |
docquery | |
.exec() | |
.then(todoes => res.status(200).json(todoes)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const router = express.Router(); | |
const todoService = require('./todo.service'); | |
router.get('/todoes', (req, res) => { | |
todoService.getToDoes(req, res); | |
}); | |
router.post('/todo', (req, res) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<div class="button-group"> | |
<button @click="getToDoes">Refresh</button> | |
<button @click="enableAddMode" v-if="!addingToDo && !selectedToDo">Add</button> | |
</div> | |
<transition name="fade"> | |
<ul class="todoes" v-if="todoes && todoes.length"> | |
<li v-for="todo in todoes" :key="todo.id" | |
class="todo-container" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class ToDo { | |
constructor(public id: number, public name: string, public saying: string) {} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
import { Todo } from './todo'; | |
const api = 'api'; | |
class TodoService { | |
deleteTodo(todo: Todo) { | |
return axios.delete(`${api}/todo/${todo.id}`); | |
} | |
getTodoes() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const routes = require('./server/routes'); | |
const publicWeb = process.env.PUBLICWEB; | |
const app = express(); | |
app.use(bodyParser.json()); | |
app.use(bodyParser.urlencoded({ extended: false })); | |
app.use(express.static(publicWeb)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Vue, Node and Azure CosmosDB</title> | |
</head> | |
<body> | |
<div id="app"></div> | |
<script src="server/www/build.js"></script> | |
</body> |