Skip to content
sgohl edited this page Dec 8, 2023 · 26 revisions

Setup new Project

  1. Create empty project folder and fetch minimal/bare app skeleton
docker run --rm -v ${PWD}:/app ghcr.io/sgohl/wish:main bash -c 'cp -Rfv /www/app /app ; chmod -R 777 /app'
  1. Use this example compose.yml to begin
version: '2.4'

x-image: &IMAGE "ghcr.io/sgohl/wish:main"
x-appname: &APPNAME "myapp"
  
services:

  *APPNAME:
    container_name: *APPNAME
    stop_signal: "9"
    image: *IMAGE
    volumes:
      - ./app:/www/app
    ports:
      - "80:80"
      - "5000:5000"
    environment:
      APPNAME: "*APPNAME"
    #env_file:
      #- .env

Limitations

Headers

Currently, I don't see any way to support multiple headers, since shell2http excepts two empty new lines to terminate the headers from the body/response which prevents from providing a function to add an arbitrary number of headers because it won't know when no more header comes.

Unless you print your headers yourself and make sure that no body is written until your own last two empty lines.

The only built-in header that is set here, is within the Session function to set the set-cookie response header to let browser set the cookie.

Namespaces

Of course, Bash does not provide namespaces by itself. There was a discussion about prefixing the app's functions with a name and some separator, but I like the simplicity of the current naming convention. However, nobody stops you from using a prefix in your app in case you might plan to have duplicate names that already exist.

Clone this wiki locally