Skip to content

golangast/tagger

Repository files navigation

goservershell

golangast

GitHub repo file count GitHub code size in bytes GitHub repo size GitHub GitHub commit activity Go 100% status beta

Languages and Tools:

bootstrap css3 go html5 javascript mysql

goservershell

General info

This project is a template for gonew and is used for setting up a webserver using echo framework.

Why build this?

  • Go never changes
  • It is a nice way to start out a webserver without doing much

What does it do?

  • It is in pure Go so faster build times and since Go never changes it will always compile.
  • No need for npm with assets because it concatenates and optimizes them (with min command)
  • Provides code for bare basic security
  • Allows for sending emails
  • Database setup (sqlite)
  • Has middleware support
  • Is scaffolding for apis, crud, security
  • Made a video on it here

Technologies

Project is created with:

Non Go Technologies

Requirements

  • go 1.21 for gonew

Setup

Just use the new gonew

go install golang.org/x/tools/cmd/gonew@latest

gonew github.com/golangast/goservershell example.com/myserver

go mod vendor


REMEMBER TO RUN 'go mod tidy' and 'go mod vendor' after to pull down dependencies

Commands

//to run the program

go run . st 

//to optimize assets. It optimizes whats in assets/build and then adds them to assets/optimized

go run . min 

If you are familiar with https://github.com/bokwoon95/wgo then you can use the following to have live reloading. -xdir means dont watch that dir -dir means watch that directory -verbose means print out the watching directory

wgo run -file .html -xdir vendor -xdir internal -xdir src -dir assets/templates -verbose  main.go st

REMEMBER! that your assets like js/css are in the assets/build folder and they are linked in the html from the assets/optimized folder. You can always change this in the ./optimize config folder if you want. But the reloading will not pull new assets by default because it expects you to build them first so that they are linked all in one file.

Repository overview

├── cmd
├── internal (services)[just a simple database example]
│   ├── dbsql
│   │   ├── dbconn (holds the database.db)
│   │   └── user
│   ├── email (to send codes)
│   └── security (left to the user to configure)
│       ├── cookies
│       ├── crypt
│       ├── jwt
│       ├── tokens
│       └── validate
├── optimize (to optimize assets and !remember to set assets paths here)[funcs for cantenating and minifying assets and images]
├── src (app)[meat and bones of the application]
│   ├── funcmaps (functation for templates)
│   ├── handler
│       ├── get
│       │    ├── home (form to start)
│       │    └── loginemail (logging in with email)
│       └── post
│            └── createuser (post request to create a user)
│   ├── routes
│   └── server

Things to remember

    1. That this is a work in progress so things may not be 100% correct.
    1. That the asset path to the html by default are linked to assets/optimized folder
    1. That the js/css optimizations are not making function names single letter and do not like comments and may not like imports. (work around might be copy past from cdn).
    1. That templates folder is in assets folder
    1. That you do need to configure the email with your credentials so that it actually works with the form.
    1. That this is just for learning and testing and of course needs to be refined on your end.
    1. That you still need to bring along templates and assets for the binary because I didnt want to have to build it every live reload.
    1. So yes, there is a lot that needs to be done before you just make a it a binary.

Support:

zacharyendrulat98451



Special thanks

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published