This commit is contained in:
wagslane
2023-10-19 17:12:50 -06:00
3 changed files with 4 additions and 40 deletions

View File

@@ -2,8 +2,6 @@
This repo contains the starter code for the "Notely" application for the "Learn CICD" course on [Boot.dev](https://boot.dev).
This README is for reference purposes only! Follow the instructions in the course, don't start doing all the steps here in the README.
## Local Development
Make sure you're on Go version 1.20+.
@@ -20,40 +18,6 @@ Run the server:
go build -o notely && ./notely
```
*This starts the server in non-database mode.* It will serve a webpage at `http://localhost:8000`. However, you won't be able to interact with the webpage until you connect it to a MySQL database and run the migrations.
*This starts the server in non-database mode.* It will serve a simple webpage at `http://localhost:8000`.
## Database Setup
This project uses a MySQL database for persistent storage. You can install MySQL locally for local development, or connect to a remote database.
Add *your* database connection string to your `.env` file. Here's an example:
```bash
DATABASE_URL="username:password@host/dbname?tls=true"
```
Once you have an empty database, you'll need to run migrations to create the schema. Make sure you have [goose](https://github.com/pressly/goose) installed:
```bash
go install github.com/pressly/goose/v3/cmd/goose@latest
```
Then run the migrations:
```bash
./scripts/migrateup.sh
```
Start the server:
```bash
go build -o notely && ./notely
```
Because the `DATABASE_URL` environment variable is set, the server will connect to the database and serve the webpage at `http://localhost:8000`. The page should be fully functional now. You can:
* Create a user (login as that user)
* Save notes
* Logout (To log in again you'll just create a new user)
*The purpose of this project is to just be a simple CRUD app that we can use to practice CI/CD. It's not meant to be a fully functional app.*
You do *not* need to set up a database or any interactivity on the webpage yet. Instructions for that will come later in the course!

View File

@@ -29,7 +29,7 @@ var staticFiles embed.FS
func main() {
err := godotenv.Load(".env")
if err != nil {
log.Fatalf("Error loading .env file: %v", err)
log.Printf("warning: assuming default configuration. .env unreadable: %v", err)
}
port := os.Getenv("PORT")

View File

@@ -7,7 +7,7 @@
</head>
<body class="section">
<h1>Welcome to Notely</h1>
<h1>Notely</h1>
<div id="userCreationContainer" class="section">
<input id="nameField" type="text" placeholder="Enter your name">