Git Product home page Git Product logo

emarifer / flashmessages-demo Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 59 KB

Full-stack application simple for flash messages demonstration after page redirects, with HTML template rendering and using _hyperscript to handle deletions and transitions CSS from flash messages

License: MIT License

CSS 4.28% Go 78.08% HTML 17.64%
daisyui echo-framework flash-messages go golang hyperscript jwt-authentication jwt-go jwt-middleware protected-routes

flashmessages-demo's Introduction

Full Stack Golang Web App โ€“ Flash Messages Demo

Full-stack application simple for flash messages demonstration after page redirects, with HTML template rendering and using _hyperscript to handle deletions and transitions CSS from flash messages.

This is an application developed in Go with the minimalist Echo framework for the backend and the frontend rendering with the native Go template package (html/template). On the other hand, _hyperscript is used to improve the appearance of alert openings and closings. The messages remain for 5 seconds and then are automatically deleted. Likewise, Tailwind CSS and daisyUI are used from their respective CDNs.

For demonstration purposes and to simplify the code, the use of a database is simulated using a function that generates a user ("Test User") and its password ("test").

The application has the expiration time for the token set to 1 hour. This means that after 1 hour the user session will be automatically logged out. This is something we want to avoid, especially if the user is still active and working on our resource. This can be solved by introducing a refresh token. This token will have a much longer lifespan and will be used to refresh the access token.

Note: the documentations of the Echo framework and the _hyperscript JavaScript library, you can see them here and here, respectively.

Screenshots:

Login Page with errors alert:


Admin Page with success alert:


Setup:

Besides the obvious prerequisite of having Go! on your machine, you must have Air installed for hot reloading when editing code.

Start the app in development mode:

$ air # Ctrl + C to stop the application

Build for production:

$ go build -ldflags="-s -w" -o ./bin/main . # ./bin/main to run the application

Happy coding ๐Ÿ˜€!!

flashmessages-demo's People

Contributors

emarifer avatar

Watchers

 avatar  avatar

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.