11# teenyHTTP
2+
23### A basic HTTP server written in precisely 100 lines of Go.
4+
35The install script has more lines of Bash than the actual ` main.go ` source file. Even this ` README.md ` file was written in more lines than teenyHTTP.
6+
47---
8+
59## Features:
10+
611- Manual overriding of paths
712- No dependencies (install helper script requires Bash (unless you compile it yourself))
813- Easy port selection
14+
915---
16+
1017## Install & Setup:
18+
1119### Install
20+
12210 ) Ensure you have ` Bash ` installed
1322> [ !NOTE]
1423> not needed if not using install helper script
24+
1525``` shell
1626command -v bash
1727```
28+
18291 ) ` cd ` into your working directory
1930 (replace ` /your/path/to/your/files ` with your path)
2031``` shell
2132cd /your/path/to/your/files
2233```
34+
23352 ) Run the setup script
2436``` shell
2537curl -fsSL https://raw.githubusercontent.com/supraboy981322/teenyHTTP/main/install-1.sh | sh
2840``` shell
2941wget -fsSL https://raw.githubusercontent.com/supraboy981322/teenyHTTP/main/install-1.sh | sh
3042```
43+
31443 ) Follow the on-screen instructions
3245
46+
3347### Setup
48+
34491 ) Create a systemd service file
3550 (you may need ` su ` permissions, replace ` nvim ` with your prefered text editor, such as ` nano ` [ ` nano ` is easier than ` nvim ` ] )
3651``` shell
@@ -46,6 +61,7 @@ nvim /etc/systemd/system/teenyHTTP.service
4661[Unit]
4762Description=the teenyHTTP web server
4863After=syslog.target network.target
64+
4965[Service]
5066User=root
5167Group=root
@@ -54,6 +70,7 @@ ExecStart=/
5470TimeoutStopSec=20
5571KillMode=process
5672Restart=always
73+
5774[Install]
5875WantedBy=multi-user.target
5976```
@@ -71,41 +88,47 @@ systemctl start teenyHTTP.service
7188``` shell
7289systemctl status teenyHTTP.service
7390```
74- ---
91+
7592## Configuration
93+
7694- ### Setting the port
7795
7896 1 ) Open your ` settings.json ` file
7997 (replace ` /your/working/dir ` with the path to your working directory, and ` nvim ` with your prefered text editor)
98+
8099 ``` shell
81100 nvim /your/working/dir/settings.json
82101 ```
83-
84- 2 ) Edit the line that has ` " port" :`
102+
103+ 3 ) Edit the line that has ` " port" :`
85104 (replace ` 1234` with the port you want teenyHTTP to use)
86105 ```
87106 " port" : " 1234" ,
88107 ```
108+
89109- # ## Changing the override setting
110+
90111 1) Open your ` settings.json` file
91112 (replace ` /your/working/dir` with the path to your working directory, and ` nvim` with your prefered text editor)
92113 ` ` ` shell
93114 nvim /your/working/dir/settings.json
94115 ` ` `
95-
116+
96117 2) Edit the line that has ` " override" :`
97118 (replace ` 1234` with the port you want teenyHTTP to use)
98119 valid options are: ` true` and ` false` (no quotations)
99120 ```
100121 " override" : false,
101122 ```
123+
102124- # ## Configuring the override
125+
103126 1) Open your ` override.json` file
104127 (replace ` /your/working/dir` with the path to your working directory, and ` nvim` with your prefered text editor)
105128 ` ` ` shell
106129 nvim /your/working/dir/override.json
107130 ` ` `
108-
131+
109132 2) Create a new line in the following format after the openning brace ( ` {` )
110133 ` ` ` JSON
111134 " your-url/path" : " your_file/path.html" ,
@@ -116,6 +139,7 @@ systemctl status teenyHTTP.service
116139 " your-url/path" : " your_file/path.html" ,
117140 " " , " index.html"
118141 }
119- ` ` `
142+ ` ` `
143+
120144> [! WARNING]
121145> insure that you do not have a comma at the end of the last line before the ending brace
0 commit comments