Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP]feat: Add a preview service demo #19

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions example-preview-service/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
47 changes: 47 additions & 0 deletions example-preview-service/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.7</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>io.mosn.layotto</groupId>
<artifactId>example-preview-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>example-preview-service</name>
<description>example-preview-service</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.mosn.layotto</groupId>
<artifactId>layotto-sdk-springboot</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.mosn.layotto.preview;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class PreviewApplication {

public static void main(String[] args) {
SpringApplication.run(PreviewApplication.class, args);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.mosn.layotto.preview.controller;

import io.mosn.layotto.preview.domain.vo.BookCoverResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PingController {

@GetMapping("/ping")
public String ping() {
return "pong";
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.mosn.layotto.preview.controller;

import io.mosn.layotto.preview.domain.vo.BookCoverResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PreviewController {

@GetMapping("/book/cover")
public BookCoverResponse index() {
return new BookCoverResponse("test");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package io.mosn.layotto.preview.domain.vo;

public class BookCoverResponse {
private String imageUrl;

public BookCoverResponse(String imageUrl) {
this.imageUrl = imageUrl;
}

/**
* Getter method for property <tt>imageUrl</tt>.
*
* @return property value of imageUrl
*/
public String getImageUrl() {
return imageUrl;
}

/**
* Setter method for property <tt>imageUrl</tt>.
*
* @param imageUrl value to be assigned to property imageUrl
*/
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

10 changes: 10 additions & 0 deletions example-preview-service/src/main/resources/static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Preview service</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<p>This preview service aims to show you how to play with Layotto </p>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.mosn.layotto.example.preview;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
class PreviewApplicationTests {

@Test
void contextLoads() {
}

}