Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed examples from new-server to http-server #303

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion evaldo/builtins_smtpd.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

var Builtins_smtpd = map[string]*env.Builtin{

"new-smtpd": {
"smtp-server": {
Argsn: 1,
Doc: "Creates SMTP server",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) env.Object {
Expand Down
2 changes: 1 addition & 1 deletion examples/examples-wip/main_0.6.rye
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ handle-api: fn { w r } {
}
}

new-server ":8080"
http-server ":8080"
|handle "/api" ?handle-api
|serve
2 changes: 1 addition & 1 deletion examples/examples-wip/websockets_chat.rye
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ hub: fn { e } {

go-with event ?hub

new-server ":8080"
http-server ":8080"
|handle-ws "/chat" ?handle-chat
|serve
2 changes: 1 addition & 1 deletion examples/examples-wip/websockets_chat_A.rye
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ hub: fn { e } {

go-with event ?hub

new-server ":8080"
http-server ":8080"
|handle-ws "/chat" ?handle-chat
|serve
2 changes: 1 addition & 1 deletion examples/examples-wip/websockets_chat_b.rye
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ hub: fn { e } {

go-with event ?hub

new-server ":8080"
http-server ":8080"
|handle-ws "/chat" ?handle-chat
|serve
2 changes: 1 addition & 1 deletion examples/examples-wip/websockets_chat_c.rye
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ hub: fn { ch } {

go-with events ?hub

new-server ":8080"
http-server ":8080"
|handle-ws "/chat" ?handle-chat
|serve
2 changes: 1 addition & 1 deletion examples/webapp_1/main.rye
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ handle-private-api: fn { s c } {
}
}

new-server ":8080"
http-server ":8080"
|handle "/pub-api" ?handle-public-api
|handle "/priv-api" ?handle-private-api
|handle-files-from "/" %static/
Expand Down
2 changes: 1 addition & 1 deletion examples/webapp_1/main0.6.rye
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ handle-api: fn { w r } {
}
}

new-server ":8080"
http-server ":8080"
|handle "/api" ?handle-api
|serve
2 changes: 1 addition & 1 deletion examples/webapp_1/main_0.1.rye
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ handle-api: fn { w r } {
write w "Hiiii!"
}

new-server ":8080"
http-server ":8080"
|handle "/api" ?handle-api
|serve
2 changes: 1 addition & 1 deletion examples/webapp_1/main_0.2.rye
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ handle-api: fn { w r } {

print hello-resource

new-server ":8080"
http-server ":8080"
|handle "/api" ?handle-api
|serve
2 changes: 1 addition & 1 deletion examples/webapp_1/main_0.3.rye
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ handle-api: fn { w r } {

print hello-resource

new-server ":8080"
http-server ":8080"
|handle "/api" ?handle-api
|serve
2 changes: 1 addition & 1 deletion examples/webapp_1/main_0.4.rye
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ handle-api: fn { w r } {

print hello-resource

new-server ":8080"
http-server ":8080"
|handle "/api" ?handle-api
|serve
2 changes: 1 addition & 1 deletion examples/webapp_1/main_0.5.rye
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ handle-api: fn { w r } {
}
}

new-server ":8080"
http-server ":8080"
|handle "/api" ?handle-api
|serve
2 changes: 1 addition & 1 deletion examples/webapp_1/main_0.6.rye
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ handle-api: fn { w r } {
}
}

new-server ":8080"
http-server ":8080"
|handle "/api" ?handle-api
|serve
2 changes: 1 addition & 1 deletion examples/webapp_1/main_0.rye
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ handle-api: fn { w r } {
}
}

new-server ":8080"
http-server ":8080"
|handle "/api" ?handle-api
|serve
2 changes: 1 addition & 1 deletion examples/webapp_1/main_1.rye
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ handle-public-api: fn { s c } {
}
}

new-server ":8080"
http-server ":8080"
|handle "/pub-api" ?handle-public-api
|serve
2 changes: 1 addition & 1 deletion examples/webapp_1/main_real_1.rye
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ handle-private-api: fn { s c } {
}
}

new-server ":8080"
http-server ":8080"
|handle "/pub-api" ?handle-public-api
|handle "/priv-api" ?handle-private-api
|handle-files-from "/" %static/
Expand Down
2 changes: 1 addition & 1 deletion examples/webapp_2/main_0.6.rye
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ handle-api: fn { w r } {

db: open postgres://webapp2:password@webapp2

new-server ":8080"
http-server ":8080"
|handle "/api" ?handle-api
|serve
2 changes: 1 addition & 1 deletion examples/webapp_2/main_0.7.rye
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ db: open postgres://webapp2:password@/webapp2

; the server

new-server ":8080"
http-server ":8080"
|handle "/api" ?handle-api
|serve

Expand Down
2 changes: 1 addition & 1 deletion examples/webapp_2/main_0.8.rye
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ db: open postgres://webapp2:password@/webapp2

; the server

new-server ":8080"
http-server ":8080"
|handle "/api" ?handle-api
|serve

Expand Down
2 changes: 1 addition & 1 deletion examples/webapp_4/webserver.rye
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ handle-api: fn { w r } {

; the server

new-server ":8080"
http-server ":8080"
|handle "/" fn { w req } { write w page "Demo" "Use the /api, Luke" }
|handle "/api" ?handle-api
|serve
Expand Down
2 changes: 1 addition & 1 deletion examples/webapp_spacememo/main.rye
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ sess: "main-session"

; the server

new-server ":8080"
http-server ":8080"
|handle "/api" ?handle-api
|serve

Expand Down
2 changes: 1 addition & 1 deletion examples/webapp_spacememo/main_0.9.rye
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ sess: "main-session"

; the server

new-server ":8080"
http-server ":8080"
|handle "/api" ?handle-api
|serve

Expand Down
2 changes: 1 addition & 1 deletion examples/webserver/ctrl_download.rye
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ handle-file-get: fn { w r } {
}

; setup the server
new-server ":8080"
http-server ":8080"
|handle "/get" ?handle-file-get
|handle "/" new-static-handler %www
|serve
Expand Down
4 changes: 2 additions & 2 deletions examples/webserver/ctrl_download_nocomm.rye
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ handle-file-get: fn { w r } {
file .copy w
}

new-server ":8080"
http-server ":8080"
|handle "/get" ?handle-file-get
|serve

Expand Down Expand Up @@ -59,7 +59,7 @@ new-server ":8080"
; |send-file\attachment w "application/x-pkcs12" "mycert.p12"
; }

; new-server ":8080"
; http-server ":8080"
; |flaskish-handle "/get" ?get-file
; |serve

Expand Down
2 changes: 1 addition & 1 deletion examples/webserver/hello.rye
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

rye .needs { http }

new-server ":8081"
http-server ":8081"
|handle "/hello" fn { w r } { .write "Hello world" }
|serve

Expand Down
10 changes: 5 additions & 5 deletions examples/webserver/main.rye
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ rye .needs { http }

; serve hello world

new-server ":8081"
http-server ":8081"
|handle "/hello" fn { w r } { .write "Hello world" }
|serve

; serve all static files from www folder

new-server ":8080"
http-server ":8080"
|handle "/" new-static-handler %www ; TODO rename, integrate http-dir
|serve

Expand All @@ -22,7 +22,7 @@ new-server ":8080"

sh: new-static-handler %static

new-server ":8082"
http-server ":8082"
|handle "/static/" sh
|handle "/" fn { w r } { .write now }
|serve
Expand All @@ -37,7 +37,7 @@ get-user: fn { w r } {
|to-json |write* w
}

new-server ":8080"
http-server ":8080"
|handle "/user/" get-user
|serve

Expand All @@ -51,7 +51,7 @@ upload: fn { w r } {
copy holder file
}

new-server ":8080"
http-server ":8080"
|handle "/" new-static-handler %www
|handle "/upload" ?upload
|serve
Expand Down
2 changes: 1 addition & 1 deletion examples/webserver/public_html.rye
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

rye .needs { http }

new-server ":8082"
http-server ":8082"
|handle "/" new-static-handler %public_html
|serve

2 changes: 1 addition & 1 deletion examples/webserver/static_folder.rye
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ rye .needs { http }

sh: new-static-handler %static

new-server ":8083"
http-server ":8083"
|handle "/static/" strip-prefix sh "/static/"
|handle "/" fn { w r } { .write to-string now }
|serve
Expand Down
2 changes: 1 addition & 1 deletion examples/webserver/upload.rye
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ upload: fn { w r } {
write w "OK"
}

new-server ":8080"
http-server ":8080"
|handle "/" new-static-handler %www
|handle "/upload" ?upload
|serve
Expand Down
2 changes: 1 addition & 1 deletion examples/webserver/websocket.rye
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

rye .needs { http }

new-server ":9090"
http-server ":9090"
|handle-ws "/echo" fn { s ctx } { forever { read s |write* s } }
|handle-ws "/captcha" fn { s ctx } {
write s "Hasta la vista,"
Expand Down