Resources
-Here are some links to help you get started:
- - - - -Next Steps
-What do you want to do next with your app?
- - - -ng generate component xyz-
ng add @angular/material-
ng add _____-
ng test-
ng build --prod-
diff --git a/server/app.js b/server/app.js index ab7aed4..c7a42c8 100644 --- a/server/app.js +++ b/server/app.js @@ -5,7 +5,6 @@ var cookieParser = require('cookie-parser'); var logger = require('morgan'); var indexRouter = require('./routes/index'); -var usersRouter = require('./routes/users'); var app = express(); @@ -20,7 +19,6 @@ app.use(cookieParser()); app.use(express.static(path.join(__dirname, 'public'))); app.use('/', indexRouter); -app.use('/users', usersRouter); // catch 404 and forward to error handler app.use(function(req, res, next) { diff --git a/server/routes/index.js b/server/routes/index.js index ecca96a..f148084 100644 --- a/server/routes/index.js +++ b/server/routes/index.js @@ -1,9 +1,11 @@ -var express = require('express'); +const express = require('express'); +const fs = require('fs'); + var router = express.Router(); /* GET home page. */ router.get('/', function(req, res, next) { - res.render('index', { title: 'Express' }); + res.json(JSON.parse(fs.readFileSync('../database/data.json').toString())); }); module.exports = router; diff --git a/server/routes/users.js b/server/routes/users.js deleted file mode 100644 index 623e430..0000000 --- a/server/routes/users.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express'); -var router = express.Router(); - -/* GET users listing. */ -router.get('/', function(req, res, next) { - res.send('respond with a resource'); -}); - -module.exports = router; diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 06c7342..b6d689a 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,8 +1,13 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; +import { HomeComponent } from './components/home/home.component'; +import { LoginComponent } from './components/login/login.component'; -const routes: Routes = []; +const routes: Routes = [ + {path: '', component: HomeComponent}, + {path: 'login', component: LoginComponent} +]; @NgModule({ imports: [RouterModule.forRoot(routes)], diff --git a/src/app/app.component.html b/src/app/app.component.html index 7feacad..90c6b64 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,538 +1 @@ - - - - - - - - - - - - -
- -Here are some links to help you get started:
- - - - -What do you want to do next with your app?
- - - -ng generate component xyz-
ng add @angular/material-
ng add _____-
ng test-
ng build --prod-
home works!
diff --git a/src/app/components/home/home.component.scss b/src/app/components/home/home.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/components/home/home.component.spec.ts b/src/app/components/home/home.component.spec.ts new file mode 100644 index 0000000..490e81b --- /dev/null +++ b/src/app/components/home/home.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { HomeComponent } from './home.component'; + +describe('HomeComponent', () => { + let component: HomeComponent; + let fixture: ComponentFixturelogin works!
diff --git a/src/app/components/login/login.component.scss b/src/app/components/login/login.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/components/login/login.component.spec.ts b/src/app/components/login/login.component.spec.ts new file mode 100644 index 0000000..d6d85a8 --- /dev/null +++ b/src/app/components/login/login.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { LoginComponent } from './login.component'; + +describe('LoginComponent', () => { + let component: LoginComponent; + let fixture: ComponentFixture