Skip to content

lab-coop/lab-http-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lab-http-server

Build Status

Setup

Install it npm install lab-http-server lab-di

Use it through lab-di:

const container = require('lab-di')();
require('lab-http-server')(container);
const httpServer = container.get('lab-http-server');

Usage

const server = httpServer.createServer('http://localhost:5000');
server.get('/*', (ctx, next) => {
 ctx.body = 'Hello!'
 return next().then(() => console.log('later'))
});
server.start();

This package itself does not rely on async/await, but you may use it wherever available:

server.get('/*', async (ctx, next) => {
 ctx.body = 'Hello!'
 await next()
 console.log('later')
});

Tests

Start a test loop via npm test.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors