This is an introductory workshop to Google Cloud App Engine. In this repository you will find the nodejs/angular front-end application that the participants shall implement a back-end for. The front-end application has a configurable back-end so this application will only have to be deployed once, and then all the participants can use it. The intention is that the instructors has set this application up as the default
service in a Google Cloud project that the workshop participants will be given access to.
The workshop will introduce the participants to
- Google Cloud SDK
- Google Cloud Console
- Basic Spring Boot
- Application deployment with Google Cloud
Instructors must speak about the following topics
- Spring Boot (basic introduction)
- Spring Rest services
@RestController
@RequestMapping
@CrossOrigin
@RequestBody
@PathVariable
- CORS
- Google Cloud Console
- App Engine
- Logging
- All participants must have a Google account
- Can be Gmail or private email connected to a Google account
- Laptop
- IntelliJ (recommended) or other Java IDE
- JDK 8
- Maven 3
- nodejs (>= 6.10.1)
- git
- Access to a Google Cloud Project with billing
- Provided by instructors
- Install google-cloud-sdk:
- https://cloud.google.com/sdk/docs
- project: computas-universitet
- Follow the quickstart guide for your O/S
- Generate project
- Go to https://start.spring.io/
- Fill in the form and add 'web' as dependendy
- Click on generate and unzip somewhere on your computer
- Launch IntelliJ
- Open the generated project
- Add the following to the
<plugins>
section of pom.xml
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.3.1</version>
</plugin>
- Create file
src/main/appengine/app.yaml
replace<your service>
with a unique identity for your backend implementation, e.g.ahr
runtime: java
env: flex
service: <your service>
handlers:
- url: /.*
script: this field is required, but ignored
secure: always # Require HTTPS
manual_scaling:
instances: 1
- Verify that your application works by running the
*Application
class (has a main-method) - You can now deploy the application
mvn appengine:deploy
- Implement a REST service endpoint that has the following methods, see https://spring.io/guides/gs/rest-service/
GET /api/todos
- Returns the list of existing Todo-elements
POST /api/todos
- Accepts a Todo-element as RequestBody (payload)
- Assigns a unique id to the todo note
- Adds the Todo-element to the list of Todo-elements
- Returns the list of existing Todo-elements (including the new)
DELETE /api/todos/{id}
{id}
is a PathVariable- Delete the Todo-element with the specified
id
- Returns the list of existing Todo-elements (not-including the deleted)
- All payloads (RequestBody and ResponseBody) shall be json
- Todo datastructure
{ "_id": "<some_unique_string_identifier>" "text": "<the todo text>" }
During development it is important to have a good process where the developer easily can test the implementation without hassle. This is why developers always should have a local development environment where the application can run so that one does not have to deploy to test it. With spring-boot you can launch your application as is on your development computer, and we recommend that you also set up the front-end application to facilitate integration testing.
Run the main-method of the *Application
class.
- Clone the node-todo repository
https://github.com/mapster/node-todo.git
- Install dependencies. Run
npm install
in the cloned project - Start the front-end
npm start
You are now ready to start working.