"Alpas is a batteries-included, yet a modular, web framework for Kotlin with a very strong focus on developers' productivity. "
Installation Requirement:-
JDK >= 9.0
Gradle >= 5.6
IntelliJ IDEA Community or Ultimate edition
Creating New Project:-
Visit Alpas starter repo on GitHub and clone the repo on your local machine.
At the root of the project there is a script named alpas.
Make it executable: chmod +x ./alpas
Initialize your new project using the full package name: ./alpas init com.example.myapp
Once done, to run your app, do: ./alpas serve
If everything goes well, your web app will be available at http://localhost:8080
Configuring:-
Once the new app is initialized, you can start configuring your app. Start with the .env file that is automatically created under the project’s root directory during the initialization.
Quick Start Guide Todo List:-
In this guide, you will quickly make a simple to-do app.
###Set up mysql database:-
Navigate to the .env file under the project root folder.
In .env, update DB_PASSWORD=secret
to replace 'secret' with your password; leave blank if you did not setup your MySQL database with a password.
Update DB_DATABASE
to point to todolist
.
Go to the DatabaseConfig.kt
file in todolist > src > main > kotlin > configs
.
Uncomment // addConnections(env) by removing //.
Run the project .
Setup your task entity:-
In terminal, type ./alpas make:entity task
and tap return
this will create a new entity 'Task' and corresponding table under src > main > kotlin > entities folder.
Setup task controller :-
type ./alpas make:controller TaskController
and tap return - this creates a 'TaskController' under todolist > src > main > kotlin > controllers folder
Setup the routes:-
Navigate to the new routes.kt at todolist > src > main > kotlin
Update the page
Migrate tables to database:-
In terminal, type ./alpas make:migration create_tasks_table --create=tasks
- this will create new data migration script
In terminal, type ./alpas db:migrate
this will migrate the tasks table and columns we created earlier.
Update the front end:-
Open the welcome.peb file at todolist > src > main > resources > templates and update .
Run the todo app:-
In terminal, type ./alpas serve