Skip to content

Commit

Permalink
Merge pull request #20 from rsalz47/dungwinux
Browse files Browse the repository at this point in the history
Update: m2 spec and handle empty session token
  • Loading branch information
dungwinux committed Nov 9, 2022
2 parents d31e497 + 763a2da commit 759bdba
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 52 deletions.
146 changes: 95 additions & 51 deletions docs/milestone2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,95 +2,139 @@

#### 0. API Documentation

Usage examples for all of these api's are in `src/frontend/js/client.js`
Usage examples for all of these API's are in `src/frontend/js/client.js`

##### server/server.js
> `/comments/create`
This api is used to insert a new comment into the server-side db. The web-app uses it to insert
notes using the message-field in the leftmost view of index.html.

> `/comments/read`
This api is used to read all the currently existing notes from the server-side db. It is used to
> `POST comments/create`
This API is used to insert a new comment into the server-side DB. The web-app uses it to insert
notes using the message-field in the leftmost view of index.html.
Expected body:
```json
{
"timestamp": "string",
"user": "string",
"msg": "string",
"id": "number"
}
```

> `POST /comments/read`
This API is used to read all the currently existing notes from the server-side db. It is used to
display the notes in the leftmost view of index.html, as well as continuously refresh the comments
on the user-facing display.

> `/comments/update`
This api is used to update existing comments. It reads out a comment from the database, and changes
its data field based on the changes requested by the user.

> `/comments/delete`
This api is used to delete an existing comment. It takes in a note id and uses it to delete a note
> `POST /comments/update`
This API is used to update existing comments. It reads out a comment from the database, and changes
its data field based on the changes requested by the user.
Expected body:
```json
{
"idToUpdate": "number",
"newText": "string",
}
```

> `POST /comments/delete`
This API is used to delete an existing comment. It takes in a note id and uses it to delete a note
from the server-side db.

> `/cfg/function_list`
This api is used to return a list of function names for the target. This api's usecase basically
Expected body:
```json
{
"idToDelete": "number",
}
```

> `GET /cfg/function_list`
This API is used to return a list of function names for the target. This API's usecase basically
mirrors just running objdump on the target binary with the option to just look for function nanmes.

> `/cfg/cfg_for_func`
This api takes in a function name and queries the targets cfg-object to return the control flow
graph for the function corresponding to the name.
> `POST /cfg/cfg_for_func`
This API takes in a function name and queries the targets cfg-object to return the control flow
graph for the function corresponding to the name.
Expected body:
```json
{
"func_name": "string",
}
```

##### server/routes/user.js
> `/users`
This api returns information about all users

> `users/:id`
This api takes in a user id from the get request to it and uses it to return the data about a
user-account.

> `/users/verify`
This api validates a username/password from the data of a post request and communicates if this is
a valid combination for an existing user.

> `/users/register`
This api takes in a username/password from the data of a post request and uses it to register a new
user to the server-side db.
> `GET /users`
This API returns information about all users

> `GET /users/:id`
This API takes in a user `id` from the get request to it and uses it to return the data about a
user-account.

> `POST /users/verify`
This API validates a username/password from the data of a post request and communicates if this is
a valid combination for an existing user.
Expected body:
```json
{
"username": "string",
"password": "string",
}
```

> `POST /users/register`
This API takes in a username/password from the data of a post request and uses it to register a new
user to the server-side db.
Expected body:
```json
{
"username": "string",
"password": "string",
}
```

##### server/routes/stat.js
> `/stats`
This api simply returns an object that contains all the relevant high-level statistics information.

> `GET /stats`
This API simply returns an object that contains all the relevant high-level statistics information.

##### server/routes/source.js

> `GET /sources/list`
> `GET /sources/list`
This API acquires available files listed in `project_dir/` in the server.

> `GET /sources/file?path={p}`
> `GET /sources/file?path={p}`
This API acquires file with path `p` in `project_dir/`. If the file does not
exist, 404 returned.

#### 2. Front-end Implementation

We have many different apis for different user interfaces of our application. Since this part of the
We have many different APIs for different user interfaces of our application. Since this part of the
milestone however only asks for 4 screenshots of very specific functionalities, therefore we will
showcase 4 screenshots for the create/read/update/delete operations for the notes/comments api.
showcase 4 screenshots for the Create/Read/Update/Delete operations for the notes/comments API.

> Create
> _Create_
This screenshot showcases the comments window, and how new comments can be added to it using the
text-field and the 'send' button.

text-field and the 'send' button.
![](../imgs/notes_create.PNG)

> Read
This screenshot just showcases the comments window. The read api is used to read out comments from
the server-side db and lists them on the user interface.
> _Read_
This screenshot just showcases the comments window. The read API is used to read out comments from
the server-side db and lists them on the user interface.
![](../imgs/notes_read.PNG)

> Update
This screenshot showcases how the update api can be used to update a comment on the site
> _Update_
This screenshot showcases how the update API can be used to update a comment on the site
![](../imgs/notes_edit1.PNG)
![](../imgs/notes_edit2.PNG)

> Delete
This screenshot showcases how the delete api can be used to delete a comment on the site
> _Delete_
This screenshot showcases how the delete API can be used to delete a comment on the site
![notes_delete](../imgs/notes_delete1.PNG)
![notes_delete](../imgs/notes_delete2.PNG)


#### 3. Deployment
Our website is currently deployed at boiling-forest-11621.herokuapp.com
Our website is currently deployed at https://boiling-forest-11261.herokuapp.com/

Automatic deployment is enabled on `main` branch.

#### Work Breakdown
We did almost all of the work on this project together in one room, so we all spent approximately
the same amount of time on this project. We were able to split the project up fairly well during
this time with everyone working on different apis.
this time with everyone working on different APIs.
5 changes: 5 additions & 0 deletions src/frontend/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,8 @@ async function populateStat() {

populateUser();
populateStat();
// Automatically set token
// TODO: Remove this when login is public
if (localStorage.getItem("token") === null) {
localStorage.setItem("token", "SAMPLE_TOKEN");
}
3 changes: 2 additions & 1 deletion src/server/database.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Temporary data entries
const authTokens = ["UMASS EXPRESS_BAD"];
// Express.js could have been better to handle these
const authTokens = ["SAMPLE_TOKEN"];
const userlist = [
{
first: "Ronan",
Expand Down

0 comments on commit 759bdba

Please sign in to comment.