This backend application, built with Node.js and Express, serves as the REST API for the ScreenPulse-frontApp. It utilizes TypeScript to ensure strong and robust typing, ensuring code reliability and maintainability.
ScreenPulse REST API acts as the backend server for the ScreenPulse-frontApp application, providing endpoints for user authentication, data management, and integration with external APIs such as OMDB.
To install and set up the project locally, follow these steps:
- Clone the repository:
git clone [repository URL]
- Navigate to the project directory:
cd [project directory]
- Install dependencies:
npm install
- Set up environment variables: Create a
.env
file and specify the required variables. - Start the server:
npm start
Once the server is running, you can make requests to the provided endpoints to perform various operations such as user authentication, data retrieval, and favorites management.
- Authentication: User registration and login for authentication and authorization.
- Data Protection and Security: Ensures secure password hashing and authentication.
- OMDB API Integration: Retrieve movie, series, and video game information from the OMDB API.
- Favorites Management: CRUD operations to manage user favorites in the database.
- Node.js: Server-side JavaScript runtime environment.
- Express.js: Web application framework for Node.js.
- Dotenv: Library for managing environment variables.
- Bcryptjs: Library for secure password hashing.
- Mongoose: MongoDB object modeling tool.
- MongoDB Atlas: Cloud-based database service.
- Axios: Promise-based HTTP client for making requests to servers.
- Render: Hosting service.
Authenticates a user.
POST /api/user/login
Field | Type | Description |
---|---|---|
email |
string |
Required. User email |
password |
string |
Required. User password |
Registers a new user.
POST /api/user/register
Field | Type | Description |
---|---|---|
userName |
string |
Required. Username |
email |
string |
Required. User email |
password |
string |
Required. User password |
Retrieves all movies/series/videogames matching searching criteria from the OMDB API.
POST /api/omdb
Field | Type | Description |
---|---|---|
s |
string |
Required. Search term |
type |
string |
Type of media (movie, series, episode) |
y |
string |
Year |
Retrieves detailed information about a specific movie from the OMDB API.
GET /api/omdb/:id
Field | Type | Description |
---|---|---|
id |
string |
Required. OMDB ID of the movie |
Creates a new favorite.
POST /api/favorites/:id
Field | Type | Description |
---|---|---|
id |
string |
Required. User ID |
Retrieves all favorites of a user.
GET /api/favorites/:id
Field | Type | Description |
---|---|---|
id |
string |
Required. User ID |
Deletes a favorite by ID.
DELETE /api/favorites/:id/:userId
Field | Type | Description |
---|---|---|
id |
string |
Required. Required. ID of the favorite |
userId |
string |
Required. User ID |
Updates a favorite's description.
PUT /api/favorites/:id/:userId
Field | Type | Description |
---|---|---|
id |
string |
Required. Required. ID of the favorite |
userId |
string |
Required. User ID |
description |
string |
Required. New description for the favorite |
Configuration settings, including database URLs and CORS client URLs, are centralized in a .env
file. This approach simplifies the management of environment variables and enhances the modularity of the codebase.
The application is structured into separate modules for core functionalities, such as users, API integration, and favorites management. Each module consists of independent controllers, routes, and services, promoting clear separation of concerns and efficient code organization.
Contributions are welcome! If you'd like to contribute to the project, please fork the repository, make your changes, and submit a pull request. Be sure to follow the project's coding standards and guidelines.
This project is licensed under the MIT License.