LinkUp is a lightweight social media platform designed specifically for developers learning REST API development. Built with Node.js and Express.js, it provides a hands-on experience in creating, reading, updating, and managing posts through clean and intuitive interfaces.
Learning REST APIs can be abstract and confusing without practical implementation. Many tutorials focus on theory but lack a real-world project that ties everything together.
LinkUp offers a complete, working social media platform where you can see REST principles in action. Every feature is built around RESTful architecture, making it the perfect learning companion for backend development.
- π Education-First: Designed specifically for learning REST APIs
- π Clean Codebase: Easy-to-understand code structure for beginners
- π οΈ Practical Learning: Real-world CRUD operations implementation
- β‘ Lightweight: Minimal dependencies, maximum learning
- π¨ Simple UI: Focus on backend without complex frontend distractions
|
|
graph TB
subgraph "Client Layer"
A[Browser] --> B[EJS Templates]
B --> C[HTML/CSS UI]
end
subgraph "Server Layer"
D[Express.js Server] --> E[Route Handlers]
E --> F[Middleware]
F --> G[Controllers]
end
subgraph "Data Layer"
H[In-Memory Storage] --> I[Posts Array]
I --> J[CRUD Operations]
end
A -->|HTTP Requests| D
E -->|Process| G
G -->|Render| B
G -->|Data Access| H
style A fill:#61dafb,stroke:#000,stroke-width:2px
style D fill:#000000,stroke:#fff,stroke-width:2px
style H fill:#47a248,stroke:#000,stroke-width:2px
style B fill:#b4ca65,stroke:#000,stroke-width:2px
| Method | Endpoint | Description | Request Body |
|---|---|---|---|
GET |
/posts |
Fetch all posts | - |
POST |
/posts |
Create a new post | { username, content } |
GET |
/posts/:id |
Get specific post details | - |
PATCH |
/posts/:id |
Update existing post | { content } |
GET /postsResponse:
[
{
"id": "abc123",
"username": "johndoe",
"content": "Hello, LinkUp!"
}
]POST /posts
Content-Type: application/x-www-form-urlencoded
username=johndoe&content=My first post!Response:
{
"success": true,
"message": "Post created successfully"
}GET /posts/abc123Response:
{
"id": "abc123",
"username": "johndoe",
"content": "Hello, LinkUp!"
}PATCH /posts/abc123
Content-Type: application/x-www-form-urlencoded
content=Updated post contentResponse:
{
"success": true,
"message": "Post updated successfully"
}- Node.js 14.x or higher
- npm or yarn package manager
- Git installed on your system
- Text editor (VS Code recommended)
git clone https://github.com/VAMSHIYADAV46/linkUp.git
cd linkUp
# Install all required packages
npm installLinkUp/
βββ views/
β βββ index.ejs # All posts view
β βββ show.ejs # Single post details
β βββ new.ejs # Create new post form
β βββ edit.ejs # Edit post form
β βββ error.ejs # Custom error page
βββ public/
β βββ style.css # Stylesheet
βββ index.js # Main server file
βββ package.json # Project dependencies
βββ README.md # Documentation
# Development mode
node index.js
# Or with nodemon for auto-restart
nodemon index.jsOpen your browser and navigate to:
http://localhost:8080
- View All Posts: Navigate to the homepage to see all posts
- Create Post: Click "New Post" button and fill in the form
- View Details: Click on any post to see full details
- Edit Post: Click "Edit" button on post details page
- Update Content: Modify the content and save changes
// GET route to display all posts
app.get('/posts', (req, res) => {
res.render('index.ejs', { posts });
});
// POST route to create new post
app.post('/posts', (req, res) => {
let { username, content } = req.body;
let id = uuidv4();
posts.push({ id, username, content });
res.redirect('/posts');
});// PATCH route to update post
app.patch('/posts/:id', (req, res) => {
let { id } = req.params;
let newContent = req.body.content;
let post = posts.find(p => p.id === id);
post.content = newContent;
res.redirect('/posts');
});
|
|
|
- β CRUD Operations - Complete create, read, update workflow
- β HTTP Methods - GET, POST, PATCH usage and differences
- β
Route Parameters - Dynamic URL handling with
:id - β Request Body Parsing - Working with form data and middleware
- β Template Rendering - Server-side view generation with EJS
- β Error Handling - Custom error pages and graceful failures
- β Middleware - Understanding Express middleware pipeline
- β Redirects - Proper navigation after form submissions
- Basic CRUD operations
- RESTful routing
- EJS template integration
- Error handling
- Delete post functionality
- Input validation
- Search and filter posts
- Pagination support
- Post timestamps
- MongoDB integration
- Persistent data storage
- User profiles
- Post likes/reactions
- Comments system
- User registration
- Login/logout system
- Session management
- Protected routes
- JWT authentication
- Image upload support
- Real-time updates
- REST API documentation
- API rate limiting
- Comprehensive testing
We welcome contributions from learners and developers! Here's how you can help:
-
Fork the Repository
git clone https://github.com/VAMSHIYADAV46/linkUp.git cd linkUp -
Create Feature Branch
git checkout -b feature/YourFeature
-
Make Your Changes
- Keep code simple and readable
- Follow existing code style
- Add comments for complex logic
- Test your changes thoroughly
-
Commit Your Changes
git add . git commit -m "β¨ Add YourFeature"
-
Push to Your Fork
git push origin feature/YourFeature
-
Open Pull Request
- Describe what you've added
- Explain why it's useful for learning
- Include screenshots if applicable
- π Improve documentation
- π Fix bugs
- β¨ Add new features
- π¨ Enhance UI/UX
- π§ͺ Add tests
- π Create tutorials
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2024 MEKALA VAMSHI YADAV
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction...
- π’ Node.js Foundation - For the powerful JavaScript runtime
- β‘ Express.js Team - For the minimalist web framework
- π EJS Contributors - For the simple templating engine
- π REST API Community - For API design best practices
- π All Developers Learning REST APIs - This project is for you!
- Twitter - For simple post-based interactions
- Reddit - For community content sharing
- Dev.to - For developer-focused platforms
- π Repository: https://github.com/VAMSHIYADAV46/linkUp
- π Documentation: https://github.com/VAMSHIYADAV46/linkUp/wiki
- π Issue Tracker: https://github.com/VAMSHIYADAV46/linkUp/issues
- π¬ Discussions: https://github.com/VAMSHIYADAV46/linkUp/discussions
- π Learning Resources: REST API Guide