1.0.4 • Published 2 years ago

delayed-web v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Delayed

Another Node.js web framework inspired by Express. This is a proof of concept for now.

Install

Simply execute the following command:

# npm

$ npm install delayed-web

# yarn

$ yarn add delayed-web

Usage

You can use Delayed by importing the dependency:

const delayed = require("delayed-web");

const app = delayed();

This module is currently capable of managing GET and POST requests:

app.get('/', (req, res)=>{
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end("Hello World!");
});

app.post('/', (req, res)=>{
    console.log(req.body);
    //do something
})

This module is also capable of simple routing:

const delayed = require("delayed-web");

const app = delayed();

const userRoute = delayed.Router();

userRoute.get('/hello', (req, res)=>{
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end("Hello World from user!");
});


app.use('/users', userRouter); // /users/hello

Finally, to start your application, you only need to get it to listen to an specified port:

app.listen(3000, ()=>{
    console.log("Listening to http://localhost:3000");
})

The Future of Delayed

This is only a learning project. Is not going to be very ambitious (I was just inspired by express and tried to recreate some of its features).

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago