An open API service indexing awesome lists of open source software.

https://github.com/nazmulhossain2905/express-2.o

Express Clone "Express 2.O".
https://github.com/nazmulhossain2905/express-2.o

express express-2o express-clone expressjs

Last synced: 3 months ago
JSON representation

Express Clone "Express 2.O".

Awesome Lists containing this project

README

        

# Express 2.O

```javascript
const Express = require("./lib/Express");

const app = new Express();
const port = 3000;

app.get(
"/health",

(req, res, next) => {
req.body.checking = "checking......";

next();
},

(req, res) => {
res.status(200).json({
success: true,
message: "Server health is Wealth",
checking: req.body?.checking,
method: req.method,
path: req.path,
user: {
name: "Nazmul Hossain",
email: "[email protected]",
country: "Bangladesh",
},
});
}
);

app.post("/user", (req, res) => {
console.log(req.query);

res.status(201).json({
success: true,
body: req.body,
method: req.method,
path: req.path,
});
});

app.delete("/user", (req, res) => {
res.status(200).json({
success: true,
message: "Delete successfully",
method: req.method,
path: req.path,
});
});

app.put("/user", (req, res) => {
res.status(200).json({
success: true,
message: "Update successfully",
method: req.method,
path: req.path,
});
});

app.patch("/user", (req, res) => {
res.status(200).json({
success: true,
message: "Update successfully",
method: req.method,
path: req.path,
});
});

app.listen(port, () =>
console.log(`Server is running at http://localhost:${port}`)
);
```