Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/satyam-software-developer/postaway-backend
postaway created with nodejs for backend web development.
https://github.com/satyam-software-developer/postaway-backend
Last synced: 16 days ago
JSON representation
postaway created with nodejs for backend web development.
- Host: GitHub
- URL: https://github.com/satyam-software-developer/postaway-backend
- Owner: satyam-software-developer
- License: mit
- Created: 2024-12-17T22:01:34.000Z (18 days ago)
- Default Branch: main
- Last Pushed: 2024-12-17T22:02:28.000Z (18 days ago)
- Last Synced: 2024-12-17T23:18:12.070Z (18 days ago)
- Language: JavaScript
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Postaway Social Media API
Postaway is a social media platform API built using Express.js, designed to enable users to perform various social networking activities such as registration, authentication, post creation, commenting, liking, and more.
## Features
- **User Management**: Register and authenticate users.
- **Post Creation**: Users can create posts with text and media.
- **Commenting**: Users can comment on posts.
- **Liking**: Users can like posts.
- **File Upload**: Supports file upload for user avatars and post images.
- **Error Handling**: Graceful handling of errors with appropriate HTTP status codes and error messages.
- **Authentication**: Implements JSON Web Tokens (JWT) for user authentication.
- **Security**: Ensures security measures like data validation and input sanitization.
- **Scalable Architecture**: Uses Express.js for a scalable and modular architecture.## Installation
1. Install dependencies:
**npm install**2. Set up environment variables:
- Create a `.env` file in the root directory with the following variables:
- **PORT**=3200
- **JWT_SECRET**=your_jwt_secret_key_here3. Start the server:
**node server.js**## API Endpoints
### User Routes
- **POST /api/user/register**: Register a new user account.
- **POST /api/user/login**: Log in as a user.
- **POST /api/user/upload-avatar**: Upload user avatar.### Post Routes
- **POST /api/posts**: Create a new post.
- **POST /api/posts/upload-image**: Upload post image.
- **GET /api/posts**: Retrieve all posts.
- **GET /api/posts/:id**: Retrieve a specific post by ID.
- **PUT /api/posts/:id**: Update a specific post by ID.
- **DELETE /api/posts/:id**: Delete a specific post by ID.### Comment Routes
- **POST /api/comments**: Create a new comment.
- **GET /api/comments**: Retrieve all comments for a specific post.
- **PUT /api/comments/:id**: Update a specific comment by ID.
- **DELETE /api/comments/:id**: Delete a specific comment by ID.### Like Routes
- **POST /api/likes**: Add a like to a post.
- **DELETE /api/likes/:id**: Remove a like from a post.
- **GET /api/likes/:postId**: Retrieve all likes for a specific post.## Technologies Used
- Express.js
- JSON Web Tokens (JWT)
- bcryptjs
- Multer
- Morgan
- Helmet## Contributing
Contributions to the Postaway API are welcome! Feel free to fork the repository, make improvements, and submit pull requests for new features or bug fixes.