- Github Repository
- Deployed client
- Deployed server
- Digital Ocean App
- Spaces Host
- AWS S3 Installation Guide
Client - Setup
Install nodejs v22+. Using nvm
is the best option.
After installing, refer to the README
Client - Run
Refer to the README
Client - Test
Refer to the README
Server - Setup
Install .Net 8
# Setup mongo creds. Feel free to make your own mongodb database and connect to that.
export MONGODB_URI="<connection string>"
# Setup object storage creds
export AWS_ACCESS_KEY_ID="DO00MM6Z43GZ4V6YX8PY"
export AWS_SECRET_ACCESS_KEY="*************************************"
Server - Run
Using helper script
The helper script will verify the environment you are running in. By doing so, you should be able to successfully run the server, as long as this script can run. If the script cannot successfully run, the script will proactively tell you what is wrong with the environment and why.
./run.sh
Without hot reloading:
dotnet restore # Optional step, as `dotnet run` will restore as well
dotnet run
With hot reloading:
# Optional step, as `dotnet run` will restore as well
dotnet watch run
server/tests - Test
Using helper script
The helper script will verify the environment you are running in. By doing so, you should be able to successfully run the server, as long as this script can run. If the script cannot successfully run, the script will proactively tell you what is wrong with the environment and why.
./test.sh
Without hot reloading:
dotnet restore # Optional step, as `dotnet test` will restore as well
dotnet test
With hot reloading:
# Optional step, as `dotnet test` will restore as well
dotnet watch test
Server - Mongo
Mongo works with a simple pattern
You have:
- a client, that connects to
- a database, that opens
- a collection of documents, that can be
- filtered, and those elements can now be either
- retrieved
- updated
A collection is somewhat analogous to a table in a normal SQL database
let connectionString = Environment.GetEnvironmentVariable("MONGODB_URI")
match connectionString with
| null ->
printfn "You must set your 'MONGODB_URI' environmental variable. See\n\t https://www.mongodb.com/docs/drivers/go/current/usage-examples/#environment-variable"
exit 1
| _ ->
let client = new MongoClient(connectionString)
let database = client.GetDatabase("edu")
let collection = database.GetCollection<Course>("courses")
Assuming the previous sections's collection
will receive the filter
Any operations needs to be filtered, so it only applies to that subset of documents, whether it be that the operation is Get
or Update
let filter = Builders<Course>.Filter.Eq("Id", "intro")
let course = collection.Find(filter).FirstOrDefault()
// NOTE: Must use `box` to convert value type like `Course`, into a reference so null can be checked
match box course with
| null -> RequestErrors.NOT_FOUND $"Course not found with id {id}"
| _ -> json course
You can make a filter
without a collection
. It is simply a piece of data describing a filter
to apply.
Assuming the previous section's filter
// NOTE: Should be able to chain together .Set() calls to update multiple fields at once
let update = Builders<Course>.Update.Set(
// Pick, in an anonymous function, what field to update
(fun course -> course.Metadata.Description),
"Introducing you to the Edu platform, where higher learning persuades you"
)
// Filter to the element to effect, then apply the update, and ignore the results
collection.UpdateOne(filter, update) |> ignore
Server - Object Storage (s3)
Follow the instructions found here
# Test that you can connect to s3
aws s3 ls edu.exokomodo --endpoint-url https://sfo3.digitaloceanspaces.com