Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
github.com/tsurai/jantar
Jantar is a lightweight mvc web framework with emphasis on security written in golang. It has initially been largely inspired by Martini but prefers performance over syntactic sugar and aims to provide crucial security settings and features right out of the box.
WARNING: This project is deprecated and is not maintained anymore. The default security settings and feature are out of date and not secure anymore! Use this as reference only!
First you have to download and install the package into the import path. This can easily be done with go get:
go get github.com/tsurai/jantar
Now you can import jantar and create a simple website
package main
import (
"net/http"
"github.com/tsurai/jantar"
)
func main() {
j := jantar.New(&jantar.Config {
Hostname: "localhost",
Port: 3000,
})
j.AddRoute("GET", "/", func(respw http.ResponseWriter, req *http.Request) {
respw.Write([]byte("Hello World"))
})
j.Run()
}
Using Controller and rendering Templates is very easy with Jantar. For this simple example I'm going to assume the following directory structure. A detailed description will follow soon.
|- controllers/
|-- app.go
|- views/
|-- app/
|--- index.html
| main.go
-- controllers/app.go
package controller
import (
"github.com/tsurai/jantar"
)
type App struct {
jantar.Controller
}
func (c *App) Index() {
c.Render()
}
-- views/app/index.html
<h1>Hello Controller</h1>
-- main.go
package main
import (
"github.com/tsurai/jantar"
c "controllers"
)
func main() {
j := jantar.New(&jantar.Config {
Hostname: "localhost",
Port: 3000,
})
j.AddRoute("GET", "/", (*c.App).Index)
j.Run()
}
Jantar is by no means secure in the literal sense of the word. What it does is providing easy and fast ways to protect against the most common vulnerabilities. Security should never be left out because it is too troublesome to implement.
Some might wonder why Jantar is using /dev/urandom instead of the seemingly more secure /dev/random. Please take some minutes and read this interesting article about /dev/urandom/
These frameworks have been a source of inspiration and ideas during Jantars development.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.