

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 10
click for more info
Not enough gems
Cost: 6 gems
1: Welcome to the Blog Aggregator
incomplete
2: Config
incomplete
3: Commands
incomplete
This lesson's interactive features are locked, please to keep using them
Gator is a multi-user CLI application. There's no server (other than the database), so it's only intended for local use, but just like games in the 90's and early 2000's, that doesn't mean we can't have multiplayer functionality on a single device!
We'll use a single JSON file to keep track of two things:
The JSON file should have this structure (when prettified):
{
"db_url": "connection_string_goes_here",
"current_user_name": "username_goes_here"
}
Note: There's no user-based authentication for this app. If someone has the database credentials, they can act as any user. We'll cover auth in other courses. We want to focus on SQL, CLIs and long-running services for this project.
{
"db_url": "postgres://example"
}
Don't worry about adding current_user_name, that will be set by the application.
This package should have the following functionality exported so the main package can use it:
I also wrote a few non-exported helper functions and added a constant to hold the filename.
getConfigFilePath() (string, error)write(cfg Config) errorconst configFileName = ".gatorconfig.json"But you can implement the internals of the package however you like.
Run and submit the CLI tests from the root of your project.