mirror of
https://github.com/ION606/MailPocket.git
synced 2026-05-14 22:06:55 +00:00
added Makefile variable port
This commit is contained in:
@@ -8,9 +8,10 @@ require (
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/ncruces/go-strftime v0.1.9 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
golang.org/x/sys v0.22.0 // indirect
|
||||
modernc.org/libc v1.55.3 // indirect
|
||||
modernc.org/mathutil v1.6.0 // indirect
|
||||
modernc.org/memory v1.8.0 // indirect
|
||||
modernc.org/sqlite v1.34.5 // indirect
|
||||
golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 // indirect
|
||||
golang.org/x/sys v0.28.0 // indirect
|
||||
modernc.org/libc v1.61.13 // indirect
|
||||
modernc.org/mathutil v1.7.1 // indirect
|
||||
modernc.org/memory v1.8.2 // indirect
|
||||
modernc.org/sqlite v1.35.0 // indirect
|
||||
)
|
||||
|
||||
+11
-3
@@ -3,15 +3,22 @@ package main
|
||||
import (
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
_ "modernc.org/sqlite"
|
||||
)
|
||||
|
||||
const PORT = ":3000"
|
||||
|
||||
func main() {
|
||||
var PORT string
|
||||
if len(os.Args) > 1 {
|
||||
PORT = os.Args[1]
|
||||
} else {
|
||||
PORT = "15521"
|
||||
}
|
||||
|
||||
db, _ := sql.Open("sqlite", "emails.db")
|
||||
db.Exec(`CREATE TABLE IF NOT EXISTS emails (
|
||||
email TEXT PRIMARY KEY,
|
||||
@@ -40,5 +47,6 @@ func main() {
|
||||
w.Write([]byte("SQLite Write Server is running"))
|
||||
})
|
||||
|
||||
http.ListenAndServe(PORT, nil)
|
||||
log.Println("Starting server on port", PORT)
|
||||
log.Fatal(http.ListenAndServe(":"+PORT, nil))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user