There are tons of hotel's web applications in the world, so I've decided to create one more. In this repository you can find something useful for yourself. Specifically, I've implemented reservation system for hotels (hostels), authentication for each user (client), UI that looks not bad and much more functions that you can find helpful. I would appreciate your feedback.
- Built in Golang version 1.16
- Uses the chi router to set routes
- Uses the alexe dwards SCS session management
- Uses the nosurf for authentication and protection
- Uses the go validator to validate forms in server-side
- Uses the jackc pgx
- Uses the royal ui admin
Make sure that Go is installed on your computer. Type the following command in your terminal
go get github.com/darkside1809/bookings
After it the package is ready to use.
Import package in your project
Add following line in your *.go
file:
import "github.com/darkside1809/bookings"
Install Soda CLI
Migration is performed on a database whenever it is necessary to update or revert that database's schema to some newer or older version. To work with database migrations in your project, you need to install Soda CLI.
Get pop package to make easier CRUD operations, run migrations, and build/execute queries.
go get github.com/gobuffalo/pop/...
And install Soda to work with it in the command prompt
go install github.com/gobuffalo/pop/soda
Soda CLI usage
Once migrations have been created they can be run with either of the following commands:
soda migrate
soda migrate up
both are identical!
If you want to rollback the last applied migration, use the following command:
soda migrate down
Set up database configuration managed by database.yml
and locate it at the root of your project.
Here is a sample configuration generated for a new app based on PostgreSQL:
development:
dialect: postgres
database: myapp_development
user: postgres
password: postgres
host: 127.0.0.1
pool: 5
test:
url: {{envOr "TEST_DATABASE_URL" "postgres://postgres:postgres@127.0.0.1:5432/myapp_test"}}
production:
url: {{envOr "DATABASE_URL" "postgres://postgres:postgres@127.0.0.1:5432/myapp_production"}}
Start SMTP server
Download MailHog SMTP server and run it to send a message
...and you are all set. Let's Goooo!!!