https://github.com/hritikr/xcess
Simple and minimalistic web framework with extended features
https://github.com/hritikr/xcess
express express-clone express-like expressjs javascript webframework xcess xpress
Last synced: 3 months ago
JSON representation
Simple and minimalistic web framework with extended features
- Host: GitHub
- URL: https://github.com/hritikr/xcess
- Owner: HritikR
- Created: 2023-06-08T15:11:57.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-10T14:57:20.000Z (almost 2 years ago)
- Last Synced: 2024-03-15T11:51:37.611Z (about 1 year ago)
- Topics: express, express-clone, express-like, expressjs, javascript, webframework, xcess, xpress
- Language: JavaScript
- Homepage:
- Size: 14.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Xcess - Simple and Minimalistic Web Framework
Xcess is a lightweight, express-like and easy-to-use web framework for Node.js, inspired by Express.js. It provides a simple API for creating web applications and handling HTTP requests and responses. With Xcess, you can define routes, use middleware functions, handle static file serving, and enable Cross-Origin Resource Sharing (CORS).
## Features
- Easy routing using HTTP methods (GET, POST, PUT, DELETE)
- Middleware support for request processing
- Cross-Origin Resource Sharing (CORS) handling
- Static file serving## Installation
To install Xcess, you can use npm:
```bash
npm install xcess
```## Usage
Here's an example of how you can use Xcess:
```javascript
const xcess = require('xcess');const app = new xcess();
app.get('/', (req, res) => {
res.send('Hello World!');
})
```
---
## Route MethodsXcess provides several route methods that allow you to define handlers for different HTTP methods. Here are the available route methods:
### `app.get(path, handler)`
The `get()` method is used to define a route handler for GET requests.
**Usage Example:**
```javascript
app.get('/', (req, res) => {
// Handler logic for GET '/'
});
```### `app.post(path, handler)`
The `post()` method is used to define a route handler for POST requests.
**Usage Example:**
```javascript
app.post('/users', (req, res) => {
// Handler logic for POST '/'
});
```### `app.put(path, handler)`
The `put()` method is used to define a route handler for PUT requests.
**Usage Example:**
```javascript
app.put('/users/:id', (req, res) => {
// Handler logic for PUT '/users/:id'
});
```### `app.delete(path, handler)`
The `delete()` method is used to define a route handler for DELETE requests.
**Usage Example:**
```javascript
app.delete('/users/:id', (req, res) => {
// Handler logic for DELETE '/users/:id'
});
```### `app.all(path, handler)`
The `all()` method is used to define a route handler for all HTTP methods.
**Usage Example:**
```javascript
app.all('/users', (req, res) => {
// Handler logic for all methods '/users'
});
```