Code Monkey home page Code Monkey logo

goxt's Introduction

Goxt a laravel inspired framework written in Golang

Very thanks to gin-gonic and aymerick I use gin for the http and raymond for the template parsing without his modules create this project was not possible

Quick start

Create your first goxt project

go install github.com/BrunProgramming/goxtgen

only exec

goxtgen -name my-first-goxt-project -repo my-repo

and follow the instructions of the cli and happy coding

if you want to use the code without the project generator here is a basic example:

main.go

package main

import (
    "github.com/BrunProgramming/goxt"
    "fmt"
)

func main() {
    router := goxt.NewRouter()
    router.Static("/style","./style")
    router.Get("/",func(c goxt.Ctx) {
        c.View("main",goxt.HbsCtx{},"")
    })
    router.Get("/:name",func(c goxt.Ctx) {
        name := c.Param("name")
        c.View("hello",goxt.HbsCtx{
            "name":name,
        },""/*this is parameter is for you want to change the default views dir put "" if you want to use the default dir*/)
    })
    fmt.Println("Server listening in http://localhost:8080")
    router.Run(":8080")
}

views/main.hbs

<!DOCTYPE html>
<html>
  <head>
    <title>Goxt the best framework buffalo is noob</title>
  </head>
  <body>
   <h1>Plis enter your name below:</h1>
   <form id="form">
      <input type="text" id="input">
   </form>
    <script type="module">
      //midutrick copyright midudev©
      const $ = selector => document.querySelector(selector)
      
      $("#form").addEventListener("submit",e => {
        e.preventDefault()
        const value = $("#input").value
        history.pushState("",{},`${location.href}${value}`)
        location.reload()
      })
    </script>
  </body>
</html>

views/hello.hbs

<!DOCTYPE html>
<html>
  <head>
    <title>Goxt the best framework buffalo is noob</title>
  </head>
  <body>
   <h1>Hello {{name}}</h1>
  </body>
</html>

goxt's People

Contributors

brunprogramming avatar

Stargazers

 avatar

Watchers

 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.