Giter Site home page Giter Site logo

pattmax00 / goweb Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 1.0 86 KB

[Mirror] A Go web framework with user authentication, CSRF protection, templating, config handling, and simple migrations out of the box

Home Page: https://git.mpatterson.xyz/max/GoWeb

License: MIT License

Go 90.96% HTML 5.22% CSS 3.82%
framework go golang web webdevelopment website go-web-application api api-rest rest

goweb's People

Contributors

pattmax00 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

tfasano1

goweb's Issues

REST Methods

From my research of the docs, net/http only handles GET and POST requests. Are there plans to use a mux which can handle PUT or DELETE requests? You can trigger these requests from the templates just like any other form element using htmx.

Using Post for deleting/updating will have consequences, since Post isn't idempotent.

env.json schema

How should the config json be formatted? A default environment file should be included.

Small fixes

  • Clearing sessions without remember me (6 hours) does not work, 30 day clears for both remember me and non-remember me sessions works (8e4c5e3)
  • Remember me is not set properly when after being checked during login, it is always false (f18f512)
  • Something is wrong with the scheduler, a fatal crash occurs NOT during reboot scheduled functions, but during the timed ones (53a7803)

Once these are fixed, it is probably time for a new release

Getting the Current User

Excuse my poor Go knowledge, but I'm trying to display the current user's username on the home page using ShowHome(), in controllers/getcontrollers.go. Here's the code:

func (getController *GetController) ShowHome(w http.ResponseWriter, r *http.Request) {
	type dataStruct struct {
		Test string
	}

	user, err := models.GetCurrentUser(getController.App, r);

	if err != nil {
	    user.Username = "darkness my old friend"
	}

	data := dataStruct{
	    Test: "Hello " + user.Username + "!",
	}

	templating.RenderTemplate(getController.App, w, "templates/pages/home.html", data)
}

A valid user is never returned from GetCurrentUser(). At first I thought it was a database problem, but it seems to be working fine. Is there something wrong with this go code? Thank you.

Command line flags and Configuration

I may recall you saying you want to incorporate cli flags into goweb?
I've recently had success with a flags library https://github.com/spf13/pflag

This calls into question how we manage configuration. What type of things should be in a config file, and
what others should be configured on the cli? For example, I think it'd be more manageable to leave
db information in env.json but configure port as a cli flag.

The main gripe with using json for configuration is the lack of an ability to comment the file.
Perhaps toml, or another ml would suffice if there's an easy to use go library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.