Public | Automated Build

Last pushed: a month ago
Short Description
A simple web host for frontend project
Full Description


For the purpose of providing a web service to a Node.js project to users, we may require a small middleware to start an HTTP service to handle the HTTP requests.

Solution: Python

In python, we can use http.server to start a web service.

python3 -m http.server

This command will return the corresponding files based on your requests.

Unfortunately, this does not work for a Node.js project. We may visit, but the real target is /index.html. This will raise an unexpected 404 error.

Solution: webpack-dev-server, webpack-serve

These toolkits provided a very useful envoronment in developing. But not designed for the production.

Solution: Nginx

We can also configure Nginx and could get a perfect result.

The configuration file is pretty easy

server {
    listen       80;

    root /path/to/the/project;
    index index.html;

    location / {
        try_files $uri $uri/ /index.html  =404;

However, the steps are kind of too much.

Solution: Hou

Recently, I prepared a small script based on golang. It will do the similar job as the behavior above in Nginx, but much smaller and efficacy.

Install or update from source

If you just wish to use it. Please just use the following command:

go get -v

If you wish to make contributions to the repo. You can use the following script.

curl -L | bash

Docker image

If you are using Chinese network, you may use aliyun's mirror:

Otherwise, you may use yuikns/hou from dockerhub.

Since the logic is very easy and the dependencies on very few packages, this image is only 6MB in the current.

Example of using Docker through docker-compose

A docker-compose.yml file is a YAML file that defines how Docker containers should behave in production.

Here is an example to use Hou easily

version: '3'

    image: yuikns/hou:latest
      - 6789:6789
    restart: always
      # /app is the default root of the service
      - ./dist:/app 
#    command: ["-d", "-v" ] # other options
Docker Pull Command
Source Repository