This is the Backend repository. Finish the Getting Started section before installing the Frontend.
Scouter is a social web application designed to be a community for anime viewers. The backend repository handles the HTTP requests to the database, allowing for the frontend to retrieve the required information for a user, an anime, and a post. Scouter's routing follows DAO design pattern and employs a variety of middleware including Morgan and Helmet that execute during the Express request.
Code Coverage: 80.6% Lines
- NodeJS - 16.3.0
- AWS V3: DynamoDB
- Express - ^4.17.1
- TypeScript - ^4.3.4
List of features ready and TODOs for future development
- GET and POST requests for an Anime
- GET and POST requests for a Post
- GET and POST requests for a User
- We've written functioning routes for adding followers for a future implementation in the frontend
To-do list: We've written full CRUD operations for our entities but PUT and DELETE requests are commented out because we didn't want to give a user full access.
- Enabling full CRUD for an Admin account
- Refactoring/Cleaning up code
- More comprehensive testing
To clone the repository, run the following command in your terminal:
git clone https://github.com/j-m-smith426/Team-4-Project-1.git
Alternatively, if you have Github Desktop, you can click on Code and Open with Github Desktop. Be sure NodeJS is installed as well as a text editor. We recommend Visual Studio Code.
To check if NodeJS and Node Package Manager installed correctly, run the following command:
node --version
npm --version
Both should result in a version display. Once installed, open up the root of the repository and install Scouter's dependencies:
npm install
This will read from the package.json and install all necessary dependencies, including Express and TypeScript. At this point, the backend should be ready.
Now, you are ready to run the application. Open up the backend and run:
npm run start:dev
In the future, when you have set up the frontend and are running the application, you may see the requests being made in the console of the backend.
Use Ctrl+C
to stop the server. Now, proceed to the Scouter's Frontend.
The backend is used server-side. It is meant for communication with the frontend. The user will not need to do any more than running the backend to handle requests on the frontend. However, if you would like to test the functionality of handling requests, we recommend installing Postman.
GET
localhost:3000/api/anime/all
- Returns all the anime information within the database
GET
localhost:3000/api/anime/:subject
- The:subject
would need to be replaced with an anime name. For example:localhost:3000/api/anime/DragonBallZ
- Returns all of that specific anime's information
- Sample Output:
"anime": [
{
"CoverImage": "A DragonBallZ/DBZ.jpg",
"description": "Dragon Ball Z follows the adventures of the adult Goku who...",
"image": "A DragonBallZ/DBZ.jpg",
"TYPEID": "A#DragonBallZ",
"REFERENCE": "0"
}
GET
localhost:3000/api/anime/search/:subject
- This is how our search bar on the front end works. Replace:subject
with anything. For example:localhost:3000/api/anime/search/D
- Returns all matching anime information. With 'D', it will return Dragon Ball Z and Demon Slayer information.
POST
localhost:3000/api/anime/add
- Adds an anime to the database; requires a body:
{
"anime": {
"TYPEID": "A#{insert value here}",
"name": "",
"REFERENCE": "0",
"description": ""
}
}
GET
localhost:3000/api/users/all
- Returns all users
GET
localhost:3000/api/users/:user
- Replace:user
with a valid username- Returns specific user's information
POST
localhost:3000/api/users/add
- Creates a user; requires body parameters
GET
localhost:3000/api/Post/Anime/:subject
- Returns all posts from an anime page
GET
localhost:3000/api/Post/User/:subject
- Returns all posts connected to a user
GET
localhost:3000/api/Post/comments/:subject
- Returns all comments depending on the inputted subject
POST
localhost:3000/api/Post/add
- Adds an associated post; body parameters are required
Scouter Developers: