Skip to content

Commit

Permalink
273 default port 8000 (#274)
Browse files Browse the repository at this point in the history
* default port 8000

* add errors
  • Loading branch information
itsumura-h authored Feb 16, 2024
1 parent a2bae1e commit a042b05
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
9 changes: 4 additions & 5 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
# build: ./docker/nim/alpine
# tty: true
# ports:
# - 9000:5000
# - 9000:8000
# volumes:
# - .:/root/project

Expand All @@ -29,7 +29,7 @@ services:
VERSION: 2.0.2
tty: true
ports:
- 9000:5000
- 9000:8000
volumes:
- .:/root/project

Expand All @@ -41,7 +41,7 @@ services:
# VERSION: 1.6.10
# tty: true
# ports:
# - 9000:5000
# - 9000:8000
# volumes:
# - .:/root/project

Expand All @@ -54,7 +54,7 @@ services:
# tty: true
# privileged: true
# ports:
# - 9003:5000
# - 9003:8000
# volumes:
# - .:/root/project

Expand All @@ -79,7 +79,6 @@ services:
MYSQL_DATABASE: database
MYSQL_USER: user
MYSQL_PASSWORD: pass
TZ: Asia/Tokyo
default_authentication_plugin: mysql_native_password

postgreDb:
Expand Down
1 change: 1 addition & 0 deletions examples/example/app/errors.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type DomainError* = object of CatchableError
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Generated by the Nim Compiler v2.0.0 */
/* Generated by the Nim Compiler v2.0.2 */
var framePtr = null;
var excHandler = 0;
var lastJSError = null;
Expand Down
2 changes: 1 addition & 1 deletion src/basolato/cli/functions/serveImpl.nim
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ proc runCommand(port:int, f:bool, httpbeast:bool, httpx:bool) =
echo getCurrentExceptionMsg()
# quit 1

proc serve*(port=5000, force=false, httpbeast=false, httpx=false) =
proc serve*(port=8000, force=false, httpbeast=false, httpx=false) =
## Run server for development with hot reload.
jsBuild()
runCommand(port, force, httpbeast, httpx)
Expand Down
23 changes: 12 additions & 11 deletions src/basolato/core/route.nim
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ func middleware*(self:Routes, middleware: Controller):Routes =

return self


proc params(request:Request, route:Route):Params =
let url = request.path
let path = route.path
Expand All @@ -212,7 +213,7 @@ proc runMiddleware(req:Request, route:Route, context:Context):Future[Response] {
let params = req.params(route)
for middleware in route.middlewares:
let res = middleware.action(context, params).await
headers &= res.headers
headers = headers & res.headers

if res.status.is3xx or res.status.is4xx:
status = res.status
Expand Down Expand Up @@ -278,13 +279,13 @@ proc createResponse*(req:Request, route:Route, httpMethod:HttpMethod, context:Co
# ## .
# createHttpCodeError

proc doesRunAnonymousLogin*(req:Request, res:Response):bool =
if not ENABLE_ANONYMOUS_COOKIE:
return false
if res.isNil:
return false
if req.httpMethod() == HttpOptions:
return false
if res.headers.hasKey("set-cookie"):
return false
return true
# proc doesRunAnonymousLogin*(req:Request, res:Response):bool =
# if not ENABLE_ANONYMOUS_COOKIE:
# return false
# if res.isNil:
# return false
# if req.httpMethod() == HttpOptions:
# return false
# if res.headers.hasKey("set-cookie"):
# return false
# return true

0 comments on commit a042b05

Please sign in to comment.