Skip to content

Commit ec0c479

Browse files
committed
updates
1 parent 38ba2a9 commit ec0c479

9 files changed

+48
-6
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ yarn-error.log
3636
/libpeerconnection.log
3737
testem.log
3838
/typings
39+
.env
3940

4041
# System files
4142
.DS_Store

backend/app.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ const parser = require("body-parser");
33
const mongoose = require("mongoose");
44
const Post = require("./models/post");
55

6+
require('dotenv/config');
7+
68
const app = express();
79

810
mongoose
911
.connect(
10-
"mongodb+srv://rmatovu987:arkounts@cluster0.rcg5o9d.mongodb.net/posts?retryWrites=true&w=majority",
12+
process.env.DB_CONNECTION,
1113
{ useNewUrlParser: true, useUnifiedTopology: true }
1214
)
1315
.then(() => {

package-lock.json

+14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"@angular/platform-browser-dynamic": "~13.3.0",
2323
"@angular/router": "~13.3.0",
2424
"body-parser": "^1.20.0",
25+
"dotenv": "^16.0.1",
2526
"express": "^4.18.1",
2627
"mongoose": "^6.4.5",
2728
"rxjs": "~7.5.0",

src/app/app-routing.module.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import { PostListComponent } from './posts/post-list/post-list.component';
55

66
export const routes: Routes = [
77
{ path: '', component: PostListComponent },
8-
{ path: 'new', component:PostCreateComponent}
8+
{ path: 'new', component: PostCreateComponent },
99
];
1010

1111
@NgModule({
12-
imports: [RouterModule.forRoot(routes)]
12+
imports: [RouterModule.forRoot(routes)],
13+
exports: [RouterModule],
1314
})
1415
export class AppRoutingModule {}

src/app/app.component.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<app-header></app-header>
22
<main>
3-
<app-post-create></app-post-create>
4-
<app-post-list></app-post-list>
3+
<router-outlet></router-outlet>
54
</main>
65

src/app/app.module.ts

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { HttpClientModule } from '@angular/common/http';
22
import { NgModule } from '@angular/core';
33
import { FormsModule } from '@angular/forms';
44
import { BrowserModule } from '@angular/platform-browser';
5+
import { AppRoutingModule } from './app-routing.module';
56

67
import { MatButtonModule } from '@angular/material/button';
78
import { MatCardModule } from '@angular/material/card';
@@ -19,6 +20,7 @@ import { PostListComponent } from './posts/post-list/post-list.component';
1920
declarations: [AppComponent, PostCreateComponent, HeaderComponent, PostListComponent],
2021
imports: [
2122
BrowserModule,
23+
AppRoutingModule,
2224
FormsModule,
2325
HttpClientModule,
2426
BrowserAnimationsModule,

src/app/header/header.component.css

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ul{
2+
display: block;
3+
padding: 0;
4+
margin: 0;
5+
list-style: none;
6+
}
7+
8+
a{
9+
text-decoration: none;
10+
color: white;
11+
}
12+
13+
.spacer{
14+
flex: 1 1 auto;
15+
}

src/app/header/header.component.html

+8-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
<mat-toolbar color="primary">My Messages</mat-toolbar>
1+
<mat-toolbar color="primary">
2+
<span><a [routerLink]="['/']" routerLinkActive="router-link-active" >My Messages</a></span>
3+
<span class="spacer"></span>
4+
<ul>
5+
<li><a mat-button [routerLink]="['/']" routerLinkActive="router-link-active" >Home</a></li>
6+
<li><a mat-button [routerLink]="['/new']" routerLinkActive="router-link-active" >New Post</a></li>
7+
</ul>
8+
</mat-toolbar>

0 commit comments

Comments
 (0)