playframework - Reading file for users
Posted on September 4, 2024
by Mandla Mbuli
I want to use a file for reading users for in the login. This is because I am expecting maybe 30 users and I think I can setup passwords for all of them manually. I also want to use sqlite for the database and I think this will start me down the path of file syncing on the server my machine.
Reading a file with Scala
I must probably buy a book from Alex now. I am using another snippet from him.
I got the file reading snippet from him.
Testing with playframework
I’d like to see it works the way I expect, time to add tests.
This is the more Scala than playframework so we can start writing tests now. Play gives a default test.
Running a single test
Run sbt
interactively and then use testOnly
sbt
sbt> testOnly package.to.run.TestSpec
sbt> testOnly *TestSpec
sbt> testOnly *TestSpec -- -z "TestName"
I’m using the AnyFlatSpec since it is the recommended for those who don’t care. I like that I can change it though.