This is an example project about how to use Ocean (https://github.com/SommerEngineering/Ocean) as framework. First of all, you have to setup your Go compiler (http://golang.org/) and the environment e.g. setup the workspace, etc. (http://golang.org/doc/code.html).
Next, you should install Git e.g. on Microsoft Windows use https://git-scm.com/. With Git, you are convenient to get any Go library and framework from e.g. GitHub (https://github.com/), where Ocean waits for you. After Git is installed, run this command on a command line: `go get -u github.com/SommerEngineering/Ocean`. This installs the Ocean framework for you. To get also this example project, run: `go get -u github.com/SommerEngineering/Example003`.
You are now ready to compile this Ocean example. Go to the project's directory e.g. on Microsoft Windows `c:\Golang\src\github.com\SommerEngineering\Example003` and execute the command `go install`. The executable is then installed e.g. in `c:\Golang\bin`. You have to prepare the environment e.g. setup a MongoDB server (https://www.mongodb.org/) and the project's configuration (see https://github.com/SommerEngineering/Ocean for details).
After everything is fine, you are able to start your server by executing the executable. You will see the console logging and your handlers are available. The admin handlers are bind to localhost: http://127.0.0.1:60000/version and http://127.0.0.1:60000/test. You can access the admin's interface by http://127.0.0.1:60000/. The public handlers are bind to your current IP address.
In order to run the example with the questions and answers (shows you how to use e.g. the template engine, the customer database access and I18N), you have to upload the HTML templates. Therefore, you must create an archive `templates.zip` where you store all your templates. In case of this example, you store the `Question.html` and `Answers.html` files from `github.com/SommerEngineering/Example003/Archives/templates.zip/`. Afterwards, use the admin's interface of the running server (http://127.0.0.1:60000/) to upload the archive into the distributed grid file system of the database. Finnaly, you have to restart the server to load the template. Then, you are able to access the example on the path `/question` on the public web server.
The questions and answers example works like this: First, you utilise `/question` handler i.e. path to get the question. Read the handler code to see how to use the template and I18N engine. If you submit your answer, the answer will be send to `/store`. The store handler will try to store the answer to the customer database. Afterwards, the store handler redirects the client i.e. browser to `/answers`. The answers handler will show all stored answers.