All Projects → vzardlloo → crab

vzardlloo / crab

Licence: MIT License
🦀 a simple web server

Programming Languages

java
68154 projects - #9 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to crab

Mofuw
mofuw is *MO*re *F*aster, *U*ltra minimal *W*ebserver.
Stars: ✭ 107 (+494.44%)
Mutual labels:  web-server, http-server
Servr
A simple HTTP server in R
Stars: ✭ 228 (+1166.67%)
Mutual labels:  web-server, http-server
Hummingbird
Lightweight, flexible HTTP server framework written in Swift
Stars: ✭ 114 (+533.33%)
Mutual labels:  web-server, http-server
Binserve
A blazingly fast static web server with routing, templating, and security in a single binary you can set up with zero code. ⚡️🦀
Stars: ✭ 401 (+2127.78%)
Mutual labels:  web-server, http-server
tipi
Tipi - the All-in-one Web Server for Ruby Apps
Stars: ✭ 214 (+1088.89%)
Mutual labels:  web-server, http-server
Caddy
Matthew Holt began developing Caddy in 2014 while studying computer science at Brigham Young University. (The name "Caddy" was chosen because this software helps with the tedious, mundane tasks of serving the Web, and is also a single place for multiple things to be organized together.) It soon became the first web server to use HTTPS automatically and by default, and now has hundreds of contributors and has served trillions of HTTPS requests.
Stars: ✭ 35,966 (+199711.11%)
Mutual labels:  web-server, http-server
Catacumba
Asynchronous web toolkit for clojure built on top of Ratpack / Netty
Stars: ✭ 192 (+966.67%)
Mutual labels:  web-server, http-server
Facebooc
Yet another Facebook clone written in C
Stars: ✭ 483 (+2583.33%)
Mutual labels:  web-server, http-server
Kvantum
An intellectual (HTTP/HTTPS) web server with support for server side templating (Crush, Apache Velocity and JTwig)
Stars: ✭ 17 (-5.56%)
Mutual labels:  web-server, http-server
Mongols
C++ high performance networking with TCP/UDP/RESP/HTTP/WebSocket protocols
Stars: ✭ 250 (+1288.89%)
Mutual labels:  web-server, http-server
Fenix
A simple and visual static web server with collaboration features.
Stars: ✭ 1,559 (+8561.11%)
Mutual labels:  web-server, http-server
sheret
A tiny, simple static file web server.
Stars: ✭ 45 (+150%)
Mutual labels:  web-server, http-server
Andserver
🍒 Web server and web framework of Android platform.
Stars: ✭ 2,932 (+16188.89%)
Mutual labels:  web-server, http-server
tinyweb
Simple and lightweight HTTP async server for micropython
Stars: ✭ 182 (+911.11%)
Mutual labels:  web-server, http-server
stirfry
StirFry is a self contained and lightweight web framework for nodejs
Stars: ✭ 24 (+33.33%)
Mutual labels:  web-server, http-server
httpbun
A simple HTTP server with responses tuned to be useful in testing HTTP clients. Heavily inspired by httpbin, but doesn't intend to be a perfect clone.
Stars: ✭ 14 (-22.22%)
Mutual labels:  http-server
lazurite
A simple http server.
Stars: ✭ 17 (-5.56%)
Mutual labels:  http-server
fs-over-http
A filesystem interface over http, with extras and docker support
Stars: ✭ 14 (-22.22%)
Mutual labels:  http-server
eephttpd
Serving simple static sites directly to i2p via the SAM API. (Also part of https://github.com/eyedeekay/sam-forwarder)
Stars: ✭ 15 (-16.67%)
Mutual labels:  http-server
Kvpbase
Scalable, simple RESTful object storage platform, written in C#
Stars: ✭ 43 (+138.89%)
Mutual labels:  http-server

🦀 Crab

Crab是一款简单的、轻量级的、采用Java开发的http服务器,主要用到了NIO与多线程技术

特点

  • 简单小巧,便于帮助理解http服务器的基本工作原理
  • 配置使用简单
  • 依赖很少,仅依赖了lombok来简化代码书写,和dom4j来操作配置文件

注:在运行源码时要安装lombok插件,关于lombok

进展

  • 基本功能完成
  • 开发更多功能

使用

首先添加依赖:

<dependency>
    <groupId>io.github.vzardlloo</groupId>
    <artifactId>crab</artifactId>
    <version>${latest version}</version>
</dependency>

or

compile 'io.github.vzardlloo:crab:${latest version}'

Crab的使用非常简单:

首先在项目的resource目录下创建crab.xml,内容为

<crabConfig>
    <item key="port" value="端口号"/>
    <item key="workspace" value="工作空间路径"/>
</crabConfig>

然后开始使用crab,代码非常简单直观:

public static void main(String[] args) throws IOException {
        new Crab().start();
    }

即可启用crab。 以上是默认的使用方式,你还可以对crab进行一些自定义,比如想自定义配置文件的存放位置,你可以这样

public static void main(String[] args) throws IOException {
        new Crab().setConfigFilePath("xxxxx").start();
    }

或者干脆不想使用配置文件也是可以的

 public static void main(String[] args) throws IOException {
        new Crab(端口号)
                .addHandler(new AssetHandler("工作空间路径"))
                .start();
    }

以上的端口号需要确保没有被占用,至于工作空间可以任意指定,不需要保证你的计算机上已经存在该路径,因为Crab会自动根据配置创建工作空间,并进行一些简单的初始化操作。

一切工作完成之后,Crab在本地启动后,在浏览器地址栏输入:localhost:端口号,会看到Crab的欢迎页面: 这时你就可以把你的html页面等放入你的Crab工作空间里,然后通过浏览器便可访问到它们。

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].