LightningServer is chock-full of useful features. This list is designed to be used as a reference for those already familiar with the library.
runServer()
LocalPubSub
LocalCache
setting()
loadSettings()
GeneralServerSettings
FilesSettings
DatabaseSettings
JwtSigner
EmailSettings
generalSettings
parsingFileSettings
prepareModels()
HasId
- provides a data class with an idHasEmail
- provides a data class with an email address
@file:UseContextualSerialization()
- enables contextual serialization for the file@Serializable
- makes a data class serializable@DatabaseModel
- makes a data class a database model
Throwing these exceptions in the body of an HttpEndpoint will automatically return the corresponding HTTP response.
BadRequestException()
- 400UnauthorizedException()
- 401ForbiddenException()
- 403NotFoundException()
- 404
path(): ServerPath
- creates aServerPath
ServerPath::get: HttpEndpoint
- creates aget
at the path of theServerPath
ServerPath::post: HttpEndpoint
- creates apost
at the path of theServerPath
ServerPath::put: HttpEndpoint
- creates aput
at the path of theServerPath
ServerPath::patch: HttpEndpoint
- creates apatch
at the path of theServerPath
ServerPath::delete: HttpEndpoint
- creates adelete
at the path of theServerPath
ServerPath::head: HttpEndpoint
- creates ahead
at the path of theServerPath
ServerPath::authEndpoints()
ServerPath::apiHelp()
- generates documentation for every typed HttpEndpoint
HttpEndpoint::handler(): HttpEndpoint
- creates a handler for theHttpEndpoint
HttpEndpoint::typed(): ApiEndpoint
- creates a typed handler for theHttpEndpoint
ServerPathGroup::path(): ServerPath
- creates aServerPath
appended to the path of theServerPathGroup
ServerPathGroup::get: HttpEndpoint
- creates aget
appended to the path of theServerPathGroup
ServerPathGroup::post: HttpEndpoint
- creates apost
appended to the path of theServerPathGroup
ServerPathGroup::put: HttpEndpoint
- creates aput
appended to the path of theServerPathGroup
ServerPathGroup::patch: HttpEndpoint
- creates apatch
appended to the path of theServerPathGroup
ServerPathGroup::delete: HttpEndpoint
- creates adelete
appended to the path of theServerPathGroup
ServerPathGroup::head: HttpEndpoint
- creates ahead
appended to the path of theServerPathGroup
ModelInfoWithDefault::serialization
- storesModelSerializationInfo
for the modelModelInfoWithDefault::collection()
- gets theFieldCollection
associated with the modelModelInfoWithDefault::defaultItem()
- creates the default model for theFieldCollection
Database::collection()
- returns a FieldCollection of a certain type
FieldCollection::withPermissions()
- adds permissions to theFieldCollection
FieldCollection::insertOne()
- adds an element to theFieldCollection
FieldCollection::insertMany()
- adds multiple elements to theFieldCollection
FieldCollection::get()
- gets an element from theFieldCollection
FieldCollection::getMany()
- gets multiple elements from theFieldCollection
FieldCollection::findOne()
- gets an element from theFieldCollection
FieldCollection::find()
- gets multiple elements from theFieldCollection
FieldCollection::updateOne()
- modifies an element in theFieldCollection
FieldCollection::updateMany()
- modifies multiple elements in theFieldCollection
FieldCollection::updateOneById()
- modifies an element in theFieldCollection
FieldCollection::replaceOne()
- replaces an element in theFieldCollection
FieldCollection::replaceOneById()
- replaces an element in theFieldCollection
FieldCollection::deleteOne()
- deletes an element in theFieldCollection
FieldCollection::deleteMany()
- deletes multiple elements in theFieldCollection
FieldCollection::deleteOneById()
- deletes an element in theFieldCollection
FieldCollection::upsertOne()
- upserts an element in/to theFieldCollection
FieldCollection::upsertOneById()
- upserts an element in/to theFieldCollection
FieldCollection::postChange()
- modifies an element after an element is added to theFieldCollection
FieldCollection::preDelete()
- deletes an element after an element is added to theFieldCollection
FieldCollection::postDelete()
- deletes an element after an element is added to theFieldCollection
FieldCollection::preCreate()
- executes code before an element is added to theFieldCollection
FieldCollection::postCreate()
- executes code after an element is added to theFieldCollection
condition(): Condition
- creates aCondition
Condition::Always()
- returns trueCondition::Never()
- returns falseand
- returns true if both of the givenConditions
are trueor
- returns true if either of the givenConditions
are truenot
- returns true if the givenCondition
is not trueeq
- returns true if the given values are equivalentneq
- returns true if the given values are not equivalentne
- equivalent toneq
gt
- returns true if the given number is greater than another numberlt
- returns true if the given number is less than another numbergte
- returns true if the given number is greater than or equal to another numberlte
- returns true if the given number is less than or equal to another numberinside
- returns true if the given value is inside a given listnotIn
- returns true if the given value is not inside a given listnin
- equivalent tonotIn
contains
- returns true if the given string is a substring of a stringallClear
- returns true if all the given bits in a bitmask that correspond to given set (1) bits are clear (0)allSet
- returns true if all the given bits in a bitmask that correspond to given set (1) bits are set (1)anyClear
- returns true if any of the given bits in a bitmask that correspond to given set (1) bits are clear (0)anySet
- returns true if any of the given bits in a bitmask that correspond to given set (1) bits are set (1)all
- returns true if the givenCondition
is true for all elements in a given listany
- returns true if the givenCondition
is true for any element in a given listsizesEquals
- returns true if the given integer is equal to the size of a given listcontainsKey
- returns true if the given map contains the given key
modification(): Modification
- creates aModification
then
- strings multipleModifications
togetherassign
- sets the given value to another valuecoerceAtMost
- restricts a given number to a given maximumcoerceAtLeast
- restricts a given number to a given minimumplus
- increments a given number by another numbertimes
- multiplies a given number by another numberplus
- appends a given string to another stringplus
- appends a given list to another listaddAll
- appends a given list to another listaddUnique
- appends a given set to another setremoveAll
- removes elements from a given list based on aCondition
removeAll
- removes elements from a given list that are equivalent to elements from another listdropFirst()
- removes the first element from a given listdropLast()
- removes the last element from a given list
Documentable::kotlinSdk()
- generates an SDK for the server in a .zip fileDocumentable::kotlinSdkLocal()
- generates an SDK for the server in a local fileDocumentable::kotlinApi()
Documentable::kotlinLiveApi()
Documentable::kotlinSessions()
Documentable::docGroup
Documentable::functionName