Skip to content

roblillack/mars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mars

A lightweight web toolkit for the Go language.

Go Reference Build status Documentation Status Coverage Status Go Report Card License

  • Latest Mars version: 1.1.0 (released May 1, 2022)
  • Supported Go versions: 1.13 … 1.23

Mars is a fork of the fantastic, yet not-that-idiomatic-and-pretty-much-abandoned, Revel framework. You might take a look at the corresponding documentation for the time being.

Have a question? Head over to our Discussions! 💬

Quick Start

Getting started with Mars is as easy as:

  1. Adding the package to your project

    $ go get github.com/roblillack/mars
  2. Creating an empty routes file in conf/routes

    $ mkdir conf; echo > conf/routes
  3. Running the server as part of your main package

    package main
    
    import "github.com/roblillack/mars"
    
    func main() {
      mars.Run()
    }

This essentially sets up an insecure server as part of your application that listens to HTTP (only) and responds to all requests with a 404. To learn where to go from here, please see the Mars tutorial

Differences to Revel

The major changes since forking away from Revel are these:

  • More idiomatic approach to integrating the framework into your application:
    • No need to use the revel command to build, run, package, or distribute your app.
    • Code generation (for registering controllers and reverse routes) is supported using the standard go generate way.
    • No runtime dependencies anymore. Apps using Mars are truly standalone and do not need access to the sources at runtime (default templates and mime config are embedded assets).
    • You are not forced into a fixed directory layout or package names anymore.
    • Removed most of the "path magic" that tried to determine where the sources of your application and revel are: No global AppPath, ViewsPath, TemplatePaths, RevelPath, and SourcePath variables anymore.
  • Added support for Go 1.5+ vendoring.
  • Vendor Mars' dependencies as Git submodules.
  • Added support for HTTP dual-stack mode.
  • Added support for generating self-signed SSL certificates on-the-fly.
  • Added graceful shutdown functionality.
  • Added CSRF protection.
  • Integrated Static controller to support hosting plain HTML files and assets.
  • Removed magic that automatically added template parameter names based on variable names in Controller.Render() calls using code generation and runtime introspection.
  • Removed the cache library.
  • Removed module support.
  • Removed support for configurable template delimiters.
  • Corrected case of render functions (RenderXml --> RenderXML).
  • Fix generating reverse routes for some edge cases: Action parameter is called args or action parameter is of type interface{}.
  • Fixed a XSS vulnerability.

Documentation

Links