Skip to content

Commit

Permalink
Add and modify API routes, declare user stuff in app.module
Browse files Browse the repository at this point in the history
I'm unsure if I formatted the app routing stuff correctly, so that should be kept in mind as a possible issue going forward.

Progresses issue #9
  • Loading branch information
Burge337 committed Mar 27, 2020
1 parent 021d95e commit c4e947d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
4 changes: 3 additions & 1 deletion client/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import { HomeComponent } from './home/home.component';
import { ViewerPageComponent } from './viewer-page/viewer-page.component';
import { AddNoteComponent } from './add/add-note.component';
import { EditComponent } from './edit/edit.component';
import { UserDoorBoardComponent } from './user-doorboard/user-doorboard.component';


const routes: Routes = [
{path: '', component: HomeComponent},
{path: 'new', component: AddNoteComponent},
{path: 'viewers', component: ViewerPageComponent},
{path: 'edit/:id', component: EditComponent}
{path: 'edit/:id', component: EditComponent},
{path: 'user/:id/new', component: UserDoorBoardComponent}
];

@NgModule({
Expand Down
4 changes: 4 additions & 0 deletions client/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ import { HttpClientModule } from '@angular/common/http';
import { LayoutModule } from '@angular/cdk/layout';
import { PDFService } from './pdf.service';
import { NotesService } from './notes.service';
import { UserService } from './user.service';
import { ViewerPageComponent } from './viewer-page/viewer-page.component';
import { AddNoteComponent } from './add/add-note.component';
import { EditComponent } from './edit/edit.component';
import { UserDoorBoardComponent } from './user-doorboard/user-doorboard.component';

const MATERIAL_MODULES: any[] = [
MatListModule,
Expand Down Expand Up @@ -59,6 +61,7 @@ const MATERIAL_MODULES: any[] = [
ViewerPageComponent,
AddNoteComponent,
EditComponent,
UserDoorBoardComponent,
],
imports: [
BrowserModule,
Expand All @@ -74,6 +77,7 @@ const MATERIAL_MODULES: any[] = [
providers: [
PDFService,
NotesService,
UserService,
],
bootstrap: [AppComponent]
})
Expand Down
9 changes: 6 additions & 3 deletions server/src/main/java/umm3601/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,14 @@ public static void main(String[] args) {

Javalin server = Javalin.create().start(4567);

// List notes for a specific user's doorboard
server.get("api/notes/user/:id", noteController::getNotes);
// Get all notes
server.get("api/notes", noteController::getNotes);

// Get all notes for a particular user
server.get("api/notes/user/:id", noteController::getUserNotes);

// Add new note to a specific user's doorboard
server.post("api/notes/new", noteController::addNote);
server.post("api/notes/user/:id/new", noteController::addNote);

// Get a single note (:id here refers to note id)
server.get("api/notes/:id", noteController::getNoteByID);
Expand Down
4 changes: 4 additions & 0 deletions server/src/main/java/umm3601/notes/NoteController.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public void getNotes(Context ctx) {
ctx.json(noteCollection.find(new Document()).into(new ArrayList<>()));
}

public void getUserNotes(Context ctx) {

}

public void addNote(Context ctx) {

Note newNote = ctx.bodyValidator(Note.class)
Expand Down

0 comments on commit c4e947d

Please sign in to comment.