mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-18 10:53:40 +00:00
Estimated hours taken: 2
Branches: main
Add a simple Google App Engine sample (requested by Julien).
The sample implements a servlet that handles HTTP GET
requests by printing a message.
samples/README:
Mention the new sample.
samples/appengine/Makefile:
Rules to build, run and deploy the sample.
samples/appengine/README:
Describe how to use the sample.
samples/appengine/servlet.m:
The servlet implementation.
samples/appengine/war/WEB-INF/appengine-web.xml:
App config file.
samples/appengine/war/WEB-INF/web.xml:
Deployment descriptor.
36 lines
1.1 KiB
Plaintext
36 lines
1.1 KiB
Plaintext
This is a very simple demo of how to deploy Mercury code to Google App Engine
|
|
using the Java backend.
|
|
|
|
The code should also work with any other servlet container.
|
|
|
|
The file servlet.m contains a simple request handler written in Mercury. It
|
|
also contains some Java foreign code that defines a subclass of
|
|
javax.servlet.http.HttpServlet.
|
|
|
|
To run this sample, first download the Google App Engine SDK from
|
|
http://code.google.com/appengine/.
|
|
|
|
After unzipping the SDK, add the file lib/shared/servlet-api.jar to your
|
|
CLASSPATH. Also add the SDK's bin directory to your PATH.
|
|
|
|
Make sure you have a recent Mercury compiler with the java grade installed and
|
|
that mmc is in your PATH.
|
|
|
|
To build the servlet do:
|
|
|
|
make
|
|
|
|
To run the servlet locally do:
|
|
|
|
make run
|
|
|
|
Then point your browser to http://localhost:8080/.
|
|
|
|
To deploy the servlet to Google App Engine, first edit the file
|
|
war/WEB-INF/appengine-web.xml and change the application id one you've created.
|
|
You can create a new application at https://appengine.google.com/. Then do:
|
|
|
|
make deploy
|
|
|
|
The sample is currently deployed to http://imlmertest.appspot.com/.
|