[JAVA] Try to create a server-client app

About this page

For the purpose of learning, I built a server-client smartphone application. This article is a reference article that summarizes the sites that were referred to when implementing. It's 1 screen, 1GetAPI, but there are many things to do and it was a great learning experience.


【Overall view】 ぷれぜんてーしょん1概要図.png


Prepare the development environment


image.png  The Server development environment is Eclipse, which I always use. No comment in particular.


image.pngimage.png Bootstrap Studio is used as a design tool. I don't think it's for professional designers, When designed by a non-designer like me

These two points are very useful.

It's about 3000 yen shareware, but it's also a permanent license with no additional cost.


image.pngimage.pngimage.png This time, front-end development adopted CORDOVA. There are two reasons.

Monaca is an integrated development environment for front-end development and can be executed from implementation to build. There is a free frame. God.


image.png circleci is a build tool like Jenkins etc. There is a free tier. Actually it was planned for Docker & Jenkins, but it died to reduce the server cost burden. This time, only the CI tool of Server was implemented.


Build Rest API Service with Spring Boot


image.pngimage.pngimage.png I started by running Hello World with Spring Boot and then extended it to Rest API.


The naming convention has become appropriate due to the development by one person, but I think it should have been practiced first.


Pack the source and test code while looking at the coverage


image.png image.png I used Spock for the test code and Jacoco for coverage measurement. I used the test code and coverage report for the first time, but it is very useful. I was happy and enjoyed the process of the source code and test code becoming more robust to each other.


JUnit chose Spock because it has readability issues, but it was also very easy to handle.


Coverage was an opportunity to think about the range of activity and test cases to be supplemented.


Create API documentation


image.pngimage.png Ask Swagger. It's OK if you write SpringFOX in Gradle and explanatory text in main class.


Build a deployment environment


image.png image.png AWS was ideal, but I decided to rent a monthly CentOS server that was handled due to learning costs.


What to do 1. Make it possible to work with Teraterm and WinSPC

What to do 2. Install the JDK for Spring Boot to work

What to do 3. Deploy Spring Boot Jar & check operation

SpringBoot includes Tomcat and can be executed by jar alone without setting up a Tomcat server.

[Step 1. Try moving it for the time being] ① Transfer the jar to the server (send by WinSCP) (2) Execute the service with java jar (path of the jar sent by hand) ③ Confirm operation at http: // (server IP): 8080 /

[Step 2. Register as a resident service] In the actual service in, the following work is done to make it resident.


Corresponds to CORS


If you proceed to this point, implementation will proceed for each server and client. On the other hand, in order to actually combine and communicate, it is necessary to support CORS (Cross-Origin Resource Sharing).


When sending such as POST, it is necessary to be aware of the preflight request.


Supports SSL communication


image.png image.png It seems that Chrome on Android does not allow communication with the API unless it is HTTPS. Since there is no help for it, I set SSL on the Server side to enable HTTPS communication.


What to do 1. Set your own domain

What to do 2. Get an SSL certificate

I used Let's Encrypt, which is provided free of charge by a non-profit organization in the United States. The Let's Encrypt certificate expires in 3 months, so it's a good idea to add cron.


What to do 3. Install nginx and link with SSL certificate

The reason I introduced nginx was because I couldn't understand how to incorporate SSL directly into Spring Boot. ..


Submit to the App Store


image.png If you want to submit to the App Store, you need a Mac (Xcode) to build the release version in principle. I used Monaca's build service for Windows users. It will run the release version build for 3300 yen for one application.


You will also be asked to register the device as build information. I bought a used iPhone 6 (B rank) for debugging the actual machine. About 9000 yen. If you're a communicator, get old from your Apple user friends.


To publish the iOS app, you need to pass the review. Even if it is NG, it will politely comment on the chat, so please correct and resubmit according to the instructions.


Submit to Google Play


image.png There is no app review on Google Play, just add the necessary information and submit.


The finished product


image.png An app that returns Mecab morpheme results and some words with meaning when you enter a classic sentence. I really got the idea that came out when I was watching TV with my wife.


Finally (time and money spent)


element cost
Construction period May-October 2019(6 months)
Man-hours About 180 hours(Conducted about 1 hour a day)
Server fee 6930 yen(990 yen x 7 months)
App Store registration fee About 10,000 yen
Google Dev registration fee About 3000 yen
Monaca paid plan About 2000 yen
Monaca build service 3300 yen
Used iPhone 6 About 9000 yen
BootStrapStudio About 3000 yen
total About 37230 yen

Although it is a single pella in the article, it took a long time to work while stumbling on the first one. I had some money, but (in terms of efficiency) I stopped sticking to no cost and tried to put it out.


That is all for the introduction. Now that I've got it right, I want to make enhancements and new apps again.

Recommended Posts

Try to create a server-client app
Try to create a bulletin board in Java
I tried to create a LINE clone app
How to create a method
[Introduction] Try to create a Ruby on Rails application
Try to make a simple callback
Preparing to create a Rails application
[Rails] I tried to create a mini app with FullCalendar
Create a new app in Rails
[Java] How to create a folder
Try to make a peepable iterator
I tried to create a simple map app in Android Studio
I want to create a chat screen for the Swift chat app!
Try deploying a Rails app on EC2-Part 1-
How to create a Maven repository for 2020
Create a TODO app in Java 7 Create Header
Try making a calculator app in Java
[Swift5] How to create a splash screen
[Rails 5] Create a new app with Rails [Beginner]
Try App Clips
Inexperienced create a weather app using OpenWeatherMap and deploy it to Netlify
Try to create a browser automatic operation environment using Selenide in 5 minutes
Steps to create a simple camel app using Apache Camel Spring Boot starters
How to create a database for H2 Database anywhere
Create a simple search app with Spring Boot
Android app: Try to summarize events and listeners
[Android] Inherit ImageView to create a new class
[Rails] rails new to create a database with PostgreSQL
[Rails] How to create a graph using lazy_high_charts
How to create pagination for a "kaminari" array
How to create a class that inherits class information
How to create a theme in Liferay 7 / DXP
[1st] How to create a Spring-MVC framework project
How to easily create a pull-down in Rails
Try to make a music player using Basic Player
[Rails] How to create a Twitter share button
[Ruby on Rails] Try to create a service that makes local cats happy
[Azure] I tried to create a Java application for free-Web App creation- [Beginner]
Create a portfolio app using Java and Spring Boot
Try create with Trailblazer
Create a docker image that runs a simple Java app
3. Create a database to access from the web module
How to create a Java environment in just 3 seconds
How to run the SpringBoot app as a service
[Rails] How to create a signed URL for CloudFront
Try to release gem
Create a weekly git GUI client [5] First desktop app
[Java] Create a filter
Reasons to include ActiveModel :: Model to create a Form object
How to create a Spring Boot project in IntelliJ
[Spring Boot] How to create a project (for beginners)
Create a Chat app with WebSocket (Tyrus) + libGDX + Kotlin
What to do if you accidentally create a model
A memorandum when trying to create a GUI using JavaFX
I tried to create a Clova skill in Java
How to create a data URI (base64) in Java
Create a Docker container to convert EPS to PGF source
How to create docker-compose
Try to solve a restricted FizzBuzz problem in Java
[Programming complete] §5 Create a review management app in Ruby
Create a JAVA WEB application and try OMC APM