scala-cask.example.mustache Maven / Gradle / Ivy
//> using scala "3.4.1"
//> using lib "{{groupId}}::{{artifactId}}:{{artifactVersion}}"
//> using repositories https://maven.pkg.github.com/{{{gitUserId}}}/{{{gitRepoId}}}
/**
* This single file can contain the business logic for a REST service.
* ====================================
* == zero-install build with docker ==
* ====================================
*
*
* ```
* docker build . -t {{artifactId}}:latest
* ```
* ======================
* == Building Locally ==
* ======================
* This project can be built using [[scala-clit][https://scala-cli.virtuslab.org]]
*
* To simply run the project
* ```
* scala-cli Server.scala
* ```
*
* To create a runnable jar, run:
* ```
* scala-cli --power package Server.scala -o app-assembly --assembly
* ```
*
* To produce a docker image (no need for the Dockerfile), run:
* ```
* scala-cli --power package --docker Server.scala --docker-image-repository app-docker
* ```
*
* To generate an IDE project:
* ```
* scala-cli setup-ide . --scala 3.3
* ```
*/
package app
import {{packageName}}.BaseApp
import {{apiPackage}}.*
import {{modelPackage}}.*
import java.io.File
// TODO - write your business logic for your services here (the defaults all return 'not implemented'):
{{#operations}}
val my{{classname}}Service : {{classname}}Service = {{classname}}Service() // <-- replace this with your implementation
{{/operations}}
/** This is your main entry point for your REST service
* It extends BaseApp which defines the business logic for your services
*/
object Server extends BaseApp({{#operations}}app{{classname}}Service = my{{classname}}Service{{^-last}},
{{/-last}}{{/operations}}):
start()
© 2015 - 2024 Weber Informatics LLC | Privacy Policy