This is the microservice for the URL-Shortener application. It is the main entry point to the entire url-shortener BaaS(Backend As A Service). A spring based java application ready to be deployed in kubernetes. Below are some of the features of this microservice.
- Supports in memory database for encoding puposes.
- Serves as the API server for the incoming request.
- Has in-build H2 database console for database monitoring and debugging.
- Build using spring framework, hence light weight and fast.
- Cassandra v3.11+
- Zookeeper v3.7.0
Before starting with the setup make sure you have java 8 or higher installed on your machine. The java version can be checked using command java --version
. Java can be downloaded using this link.
Once you have java installed you can move ahead with the following requirements.
- IDE(Integrated Development Environment) for opening the project. You can use any IDE of your choice which is capable of handeling java projects. But
IntelliJ IDEA
is highly recomended, it is easy to use and freely available IDE. Can be downloaded using this link. - Cassandra installed and running on your local host. Cassandra have pretty comprehensive guide on installing and running the application, you can follow up here.
- Once cassandra is intsalled make sure you can login into cqlsh using command
cqlsh -u <your-username> -p <your-password>
. - Now create a deafult keyspace which
urs-connector-main
uses for managing the data. This can be done by executing below command incqlsh
.CREATE KEYSPACE urlspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = 'true';
- Once cassandra is intsalled make sure you can login into cqlsh using command
- Zookeeper installed and running on your local host. Refer official documentation for setting up the zookeeper. The releases can be found here.
Once you are able to complete the above requirement setup. You can follow below setup for launching the application.
- You can get the project on your local sytem by either cloning the repository using
git
or can download the project directly using the below links.- Command:
git clone https://github.com/code-gambit/urs-connector-main.git
- Direct Download: urs-connector-main.
- Command:
- Open and wait for the project to be setup in
IntelliJ IDEA
. - To start the application open the terminal in the project path and run the below commands.
- Compile Application:
./gradlew bootJar
- Boot Application:
java -jar build/libs/url-shortner.jar
- Compile Application:
DISCLAIMER: Make sure not to force push until unavoidable.
- Fork it
- Create your feature branch
(git checkout -b my-new-feature)
- Commit your changes
(git commit -m 'Add some feature')
- Clear the checks and make sure below builds are successful
- Push your branch
(git push origin my-new-feature)
- Create a new Pull Request.