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 { Injectable } from '@angular/core'; | |
import { Observable } from 'rxjs'; | |
import { AuthHttp } from 'angular2-jwt'; | |
@Injectable() | |
export class TaskListService { | |
private static TASKS_ENDPOINT = | |
'https://wt-e1870b8a73b27cdee73c468b8c8e3bc4-0.run.webtask.io/tasks'; | |
constructor(private authHttp: AuthHttp) { } |
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
# creates the main component that lists tasks | |
ng g component task-list | |
# creates a component to hold a form to add tasks | |
ng g component task-list/task-form | |
# creates a service to handle all interaction with our REST API | |
ng g service task-list/task-list |
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
wt create webtask/tasks.js \ | |
--meta wt-compiler=webtask-tools/express \ | |
-s AUTH0_SECRET=secret-from-auth0.com \ | |
-s MONGO_USER=task-list-user \ | |
-s MONGO_PASSWORD=111222 \ | |
-s MONGO_URL=ds147069.mlab.com:47069/task-list \ | |
--prod |
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
# install Webtask CLI tool | |
npm install wt-cli -g | |
# initialize it with our email address | |
wt init [email protected] |
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
'use strict'; | |
// imports node modules | |
const express = require('express'); | |
const mongojs = require('mongojs'); | |
const bodyParser = require('body-parser'); | |
const jwt = require('jsonwebtoken'); | |
// creates Express app with JSON body parser | |
const app = new express(); | |
app.use(bodyParser.json()); |
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
.app-container { | |
padding: 20px; | |
} |
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
<app-nav-bar></app-nav-bar> | |
<div class="app-container"> | |
<md-card *ngIf="!authService.authenticated()"> | |
<md-card-title>Hello, visitor.</md-card-title> | |
<md-card-subtitle> | |
Please <a (click)="authService.signIn()">sign in</a> to manage your task list. | |
</md-card-subtitle> | |
</md-card> | |
</div> |
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 { Component } from '@angular/core'; | |
import { AuthService } from './auth.service'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', | |
styleUrls: ['./app.component.css'] | |
}) | |
export class AppComponent { | |
constructor(private authService: AuthService) { } |
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 '~@angular/material/core/theming/prebuilt/indigo-pink.css'; | |
body { | |
margin: 0; | |
} |
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
<app-nav-bar></app-nav-bar> |