Skip to content

Commit 3bf1cb5

Browse files
author
Coderian
authored
Add files via upload
1 parent 927596a commit 3bf1cb5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2801
-0
lines changed

docs/English/01_Create_server.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# 1 - Create Server - Flint
2+
3+
```go
4+
package main
5+
6+
import (
7+
flint "github.com/coderianx/Flint"
8+
)
9+
10+
func main() {
11+
app := flint.NewServer()
12+
}
13+
```
14+
15+
### - This code creates a new Flint serve

docs/English/02_Run_server.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# 2 - Run Server - Flint
2+
3+
```go
4+
package main
5+
6+
import (
7+
flint "github.com/coderianx/flint"
8+
)
9+
func main() {
10+
app := flint.NewServer()
11+
12+
app.Run(":8080")
13+
}
14+
```
15+
16+
### This code creates a new Flint server and runs it on port 8080
17+
18+
**You can open a server on different ports by changing the port number in run().**
19+
20+
### Example;
21+
22+
```go
23+
package main
24+
25+
import (
26+
"github.com/coderianx/flint"
27+
)
28+
func main() {
29+
app := flint.NewServer()
30+
31+
app.Run(":3000")
32+
}
33+
```
34+
35+
### This code creates a new Flint server and runs it on port 3000
36+
37+
### Note:
38+
If you leave `Run()` blank, Flint will use port 8080 by default.
39+
### Example;
40+
41+
```go
42+
package main
43+
44+
import (
45+
"github.com/coderianx/flint"
46+
)
47+
48+
func main() {
49+
app := flint.NewServer()
50+
51+
app.Run() // Uses port 8080 by default
52+
}
53+
```
54+
Flint uses port 8080 by default. If you do not want to use this port, you can provide any port number to the `Run()` function.

docs/English/03_handle.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# 3 - Handle
2+
3+
```go
4+
package main
5+
6+
import (
7+
"github.com/coderianx/flint"
8+
)
9+
10+
func main() {
11+
app := flint.NewServer()
12+
13+
app.Handle("/", func(ctx *flint.Context) {
14+
// ctx codes
15+
})
16+
17+
app.Run(":8000")
18+
}
19+
```
20+
21+
### In this example, we create a new server and define a route for the root path ("/"). The `Handle` method is used to associate a function with the specified path. When a request is made to this path, the function will be executed.

docs/English/04_get.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# 4 - Get
2+
3+
```go
4+
package main
5+
6+
import (
7+
"github.com/coderianx/flint"
8+
)
9+
10+
func main() {
11+
app := flint.NewServer()
12+
13+
app.Get("/", func(ctx *flint.Context) {
14+
// ctx codes
15+
})
16+
17+
app.Run(":8000")
18+
}
19+
```
20+
### In this example, we create a new server and define a GET request route for the root path ("/"). The `Get()` method is used to define a function associated with the specified path. When a GET request is made to this path, the function will be executed.
21+
---
22+
### Flint provides the `Get()` method to handle HTTP GET requests. This method is used to capture and process GET requests coming to a specific path. Flint offers a simple and effective way to manage such requests.

docs/English/05_post.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# 5 - Post
2+
3+
```go
4+
package main
5+
6+
import (
7+
"github.com/coderianx/flint"
8+
)
9+
10+
func main() {
11+
app := flint.NewServer()
12+
13+
app.Post("/", func(ctx *flint.Context) {
14+
// ctx codes
15+
})
16+
17+
app.Run(":8000")
18+
}
19+
```
20+
### In this example, we create a new server and define a POST request route for the root path ("/"). The `Post()` method is used to define a function associated with the specified path. When a POST request is made to this path, the function will be executed.
21+
---
22+
### Flint provides the `Post()` method to handle HTTP POST requests. This method is used to capture and process POST requests coming to a specific path. Flint offers a simple and effective way to manage such requests.

docs/English/06_put.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# 6 - Put
2+
3+
```go
4+
package main
5+
6+
import (
7+
"github.com/coderianx/flint"
8+
)
9+
10+
func main() {
11+
app := flint.NewServer()
12+
13+
app.Put("/", func(ctx *flint.Context) {
14+
// ctx codes
15+
})
16+
17+
app.Run(":8000")
18+
}
19+
```
20+
### In this example, we create a new server and define a PUT request route for the root path ("/"). The `Put()` method is used to define a function associated with the specified path. When a PUT request is made to this path, the function will be executed.
21+
---
22+
### Flint provides the `Put()` method to handle HTTP PUT requests. This method is used to capture and process PUT requests coming to a specific path. Flint offers a simple and effective way to manage such requests.

docs/English/07_delete.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# 7 - Delete
2+
3+
```go
4+
package main
5+
6+
import (
7+
"github.com/coderianx/flint"
8+
)
9+
10+
func main() {
11+
app := flint.NewServer()
12+
13+
app.Delete("/", func(ctx *flint.Context) {
14+
// ctx codes
15+
})
16+
17+
app.Run(":8000")
18+
}
19+
```
20+
### In this example, we create a new server and define a DELETE request route for the root path ("/"). The `Delete()` method is used to define a function associated with the specified path. When a DELETE request is made to this path, the function will be executed.
21+
---
22+
### Flint provides the `Delete()` method to handle HTTP DELETE requests. This method is used to capture and process DELETE requests coming to a specific path. Flint offers a simple and effective way to manage such requests.

docs/English/SetNotFound.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# SetNotFound - Flint
2+
3+
### How to display .html page on 404 errors
4+
5+
## Go code
6+
```go
7+
package main
8+
9+
import (
10+
"github.com/coderianx/flint"
11+
)
12+
13+
func main() {
14+
app := flint.NewServer()
15+
16+
app.SetNot(func(ctx *flint.Context) {
17+
ctx.Template("404.html")
18+
})
19+
}
20+
```
21+
### This code will display the 404.html page when a 404 error occurs.
22+
23+
### Using the original Flint 404 error page
24+
```go
25+
package main
26+
27+
import (
28+
"github.com/coderianx/flint"
29+
)
30+
31+
func main() {
32+
app := flint.NewServer()
33+
34+
app.SetNot(func(ctx *flint.Context) {
35+
ctx.Default404()
36+
})
37+
}
38+
```
39+
40+
### This code will display the original Flint 404 error page.

docs/English/ctx/01_string.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Ctx/01 | `ctx.String()`
2+
3+
```go
4+
package main
5+
6+
import (
7+
"github.com/coderianx/flint"s
8+
)
9+
10+
func main() {
11+
app := flint.NewServer()
12+
13+
// Handle GET request to "/"
14+
app.Handle("/", func(ctx *flint.Context) {
15+
// Sends default 200 status with
16+
ctx.String(200, "Hello Flint!")
17+
})
18+
19+
app.Run(":8080")
20+
}
21+
22+
```
23+
24+
🧠 This code creates a Flint server, registers a route for /, and responds with plain text using ctx.String().
25+
26+
## `ctx.Stringf()`
27+
```go
28+
package main
29+
30+
import (
31+
"github.com/coderianx/flint"
32+
)
33+
34+
func main() {
35+
app := flint.NewServer()
36+
37+
// Handle GET request to "/"
38+
app.Handle("/", func(ctx *flint.Context) {
39+
// Sends default 200 status with formatted string
40+
name := "Flint"
41+
ctx.Stringf(200, "Hello %s!", name)
42+
})
43+
44+
app.Run(":8080")
45+
}
46+
```
47+
48+
🧠 This code creates a Flint server, registers a route for /, and responds with a formatted string using ctx.Stringf().
49+

docs/English/ctx/02_File.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Ctx/02 | `ctx.File()`
2+
3+
```go
4+
package main
5+
6+
import (
7+
"github.com/coderianx/flint"
8+
)
9+
10+
func main() {
11+
app := flint.NewServer()
12+
13+
// Handle GET request to "/"
14+
app.Handle("/", func(ctx *flint.Context) {
15+
// Sends default 200 status with file
16+
ctx.File("index.html")
17+
18+
// Or specify status code manually
19+
ctx.File(200, "index.html")
20+
})
21+
22+
app.Run(":8080")
23+
}
24+
```
25+
### 🧠 This code creates a Flint server, registers a route for /, and responds with a file using ctx.File().

0 commit comments

Comments
 (0)