Supported by CRC
This is a small resource that pulls in a library for database management that can be used in all resources.
It allows users to easily set and fetch data from any resource.
This resource handles the connection part, so skip that
See lib-cross-resource-cache for further usage.
- TypeScript
- https://github.com/Stuyk/altv-typescript
- alt:V Event Suggestions
- MongoDB Server
- Choose one of the following
- MongoDB Community Server
- Free MongoDB Atlas Server
Highly recommended to get the extension, for better event handling.
Inside of your main folder, you will need to install this library.
npm i @stuyk/cross-resource-cache
-
Create a folder in your
src
folder calledcrc-db
. -
Add the
TypeScript
files from this resource, to that folder.
You can also git clone
directly into your src
folder.
Modify server.toml
and ensure it loads whatever you named the folder.
In the case of the example above it should be crc-db
.
resources = [
'mods-before-db',
'crc-db',
'resources-after-db',
'dbg_reconnect'
]
You need to modify the connectionString
in the resource to point towards the right URL.
Open src/server/index.ts
and modify the connectionString
variable.
By default it uses localhost.