7477
Twitter
what choice did they really have? systemd solves real problems so it hard to not adopt it because of nuanced…
from twitter_favs
8 hours ago
Twitter
Gophers in Thailand is growing. Last night we have first `$go get th` meetup.
from twitter_favs
yesterday
President Ramaphosa seen flying on the cheap - again | Traveller24
Don't fall for the obvious fake news. R50 Million in 4 months... that is all I am saying.
from twitter_favs
yesterday
Twitter
Why one company switched to from :
from twitter_favs
3 days ago
Introduction to Beego, a golang web application framework by @jjude
Introduction To Beego, A Golang Web Application Framework
Create a simple web application serving a json in beego, a golang web application framework.
Beego is a comprehensive web application framework for Golang. Beego includes support for:
Routing
ORM
Sessions
Templates
Caching
Command line support
Cron like tasks
Live reloading while development
Packaging of static assets
You can write a decent web-application using core Golang language. Yet, coding enterprise applications require above features. Instead of composing these from independent sources, you can use Beego which comes bundled with all of these.
If you are coming from Python ecosystem, Beego is like Django.
dep is the dependency management tool in Golang. We will use dep to install and upgrade the dependencies. Let us initialize our repository with dep init.
I wrote about dep in an earlier post. Read it to understand how to use dep.
It will create a vendor directory and two other files. Your directory should look like this:
├── Gopkg.lock
├── Gopkg.toml
├── vendor
Create a main.go file.
package main
func main() {
}
Now it is time to install beego. Install beego with dep.
dep ensure -add github.com/astaxie/beego
It will install beego under vendor directory. It is recommended to store this directory into your version control system.
.
├── Gopkg.lock
├── Gopkg.toml
├── main.go
└── vendor
└── github.com
└── astaxie
└── beego
Your Gopkg.toml should look like this:
[prune]
go-tests = true
unused-packages = true
[[constraint]]
name = "github.com/astaxie/beego"
version = "1.9.2"
Now we can start writing a web-server. Modify the main.go file with the below content.
package main
import (
"github.com/astaxie/beego"
)
func main() {
beego.Run()
}
beego.Run() runs the web server with default configuration. You can execute this with go run main.go. You will see
http server Running on http://:8080
If you open http://localhost:8080 you will see an error message, like in the following image. What is happening?
The above code-snippet created a web-server but that server doesn’t know what to do with an incoming request. Let us code that part.
package main
import (
"github.com/astaxie/beego"
)
// 1. Embed beego controller
type MainController struct {
beego.Controller
}
// 2. Code a get method
func (this *MainController) Get() {
this.Ctx.WriteString("hello world")
}
// 3. Register the router and bring up the server
func main() {
beego.Router("/", &MainController{})
beego.Run()
}
beego.Controller has methods for handling REST methods (get, post etc). We create a MainController by embedding (like inheritance in other languages) beego.Controller.
We overload only Get method. In this method we are just writing a string as an output.
We, then, register this router (for Get method) and bring up the server.
You can run this code by go run main.go. If you open the browser to http://localhost:8080, you will see a hello world.
Beego also supports serving json, xml as responses. Let us modify the above program to serve a json.
package main
import (
"github.com/astaxie/beego"
)
type MainController struct {
beego.Controller
}
func (this *MainController) Get() {
this.Data["json"] = map[string]int{"apple": 5, "lettuce": 7}
this.ServeJSON()
}
func main() {
beego.Router("/", &MainController{})
beego.Run()
}
You can open the browser to http://localhost:8080 or try curl http://localhost:8080. You will see the result as:
{
"apple": 5,
"lettuce": 7
}
This is only a tip of Beego framework. If you want to learn more, subscribe using the below form.
Links
Beego
Using dep, the Golang dependency management tool
Go By Example
Sent  from  my  iPhone  from iphone
6 days ago
Repair file sharing after Security Update 2017-001 for macOS High Sierra 10.13.1 - Apple Support
Repair file sharing after Security Update 2017-001 for macOS High Sierra 10.13.1
If you experience issues with authenticating or connecting to file shares on your Mac after you install Security Update 2017-001 for macOS High Sierra 10.13.1, follow these steps to repair file sharing:
Open the Terminal app, which is in the Utilities folder of your Applications folder.
Type sudo /usr/libexec/configureLocalKDC and press Return.
Enter your administrator password and press Return.
Quit the Terminal app.
Sent  from  my  iPhone  from iphone
6 days ago
Twitter
Locks vs. channels in concurrent :
from twitter_favs
6 days ago
Twitter
Then better use those puppeteer-based (headless chrome) pdf generators. Either roll-your-own or 3rd-part…
from twitter_favs
6 days ago
Twitter
run shellcheck
$ ls bin/* | entr -c shellcheck bin/*

run tests
$ ls bin/* | entr -c bin/backup_test

edit two…
from twitter_favs
8 days ago
Twitter
We love streaming video. But what's fascinating is how patent-encumbered that tech is. My new post explains to folk…
from twitter_favs
8 days ago
Twitter
Thanks for the feedback and willingness to participate. I have Mark Oppenheimer this weekend so I can f…
from twitter_favs
8 days ago
Twitter
Very small code repos do end up looking a little silly with all of the other files that also end up, in this case a…
from twitter_favs
9 days ago
Twitter
You probably knew that live broadcasting had some delay to it, but did you know there is a small industry dedicated…
from twitter_favs
9 days ago
Twitter
Found a blast from the past ad.
from twitter_favs
10 days ago
Twitter
You need to read this thread. This is like every bad enterprise software dev practice... but applied to a 25 year l…
from twitter_favs
12 days ago
Twitter
Reddit's CSS-in-JS was slowing rendering; they're moving to "more traditional" styling (CSS?) and have decreased co…
from twitter_favs
13 days ago
Twitter
Jump in on board and drive it to north-west direction for 10 hours, so we could finally meet in person!
from twitter_favs
15 days ago
Twitter
Customers that always expect everything for FREE are:
- 😠 Never satisfied with your service
- 😱 Complain more than…
from twitter_favs
16 days ago
Twitter
Best news to land to. Najib arrested and to be charged tomorrow. Rosmah next?
from twitter_favs
16 days ago
Profit sharing for bootstrapped startups | Nathan Barry
Stock Options or Profit Sharing. As an employee - which would you prefer?
from twitter_favs
16 days ago
Twitter
Today I’m being followed around by a TV crew from China Central TV as I make a video about why I chose to live in C…
from twitter_favs
17 days ago
vscode-recipes/README.md at master · Microsoft/vscode-recipes
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Meteor: Chrome",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
},
{
"type": "node",
"request": "launch",
"name": "Meteor: Node",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "debug"],
"port": 9229,
"timeout": 30000
}
],
"compounds": [
{
"name": "Meteor: All",
"configurations": ["Meteor: Node", "Meteor: Chrome"]
}
]
}
17 days ago
Twitter
I love how AWS Support regularly replicates our problem in a temporary environment, then tests their solution in th…
from twitter_favs
20 days ago
Twitter
When you say you don’t have a debugger, why not use the debugger? It’s…
from twitter_favs
20 days ago
Twitter
Explaining to support managers why we're using Github for small docs such as changelogs.
from twitter_favs
21 days ago
Twitter
Previously you had to wake up a consumer with a cloudwatch alarm or timer to process the que…
from twitter_favs
22 days ago
Twitter
Introducing AWS Navigate—a blueprint for to build a specialized practice on AWS:…
from twitter_favs
23 days ago
(503) https://mothership.sg/2018/06/shi-yi-obike-founder/
Real founder of is Shi Yi, a multimillionaire. S’poreans, collect your S$49 refund from him.
from twitter_favs
23 days ago
Twitter
I just published two lessons with Evan You. The first is free and shows how proxies enable reactivity,…
from twitter_favs
23 days ago
Twitter
Pretty neat, 's Snap to Roads API. Before -> After.

Context:
Some bus services don't have route line c…
from twitter_favs
27 days ago
Twitter
Ever wonder how long it takes to verify your YouTube channel with Brave Payments so you can start receiving contrib…
from twitter_favs
27 days ago
Twitter
Working on a bug together (in real time) with and OMG Visual Studio 's Live Share is the most awe…
from twitter_favs
27 days ago
Twitter
that said I still kinda like SPA because you often want a clean public api anyway, so dog f…
from twitter_favs
28 days ago
Twitter
London and Singapore are our latest data centers to offer Block Storage. Create and attach Block Storage Volumes to…
from twitter_favs
28 days ago
Twitter
Hard to believe I've switched from Jekyll to my bin/ssg only two months ago.

P.S. Going t…
from twitter_favs
28 days ago
Static site generator with rsync and lowdown - Roman Zolotarev
Hard to believe I've switched from Jekyll to my bin/ssg only two months ago.

P.S. Going t…
from twitter_favs
28 days ago
Twitter
Learn how Singapore-based Spuul is using AWS Media Services, Amazon S3 & to support live OTT video stre…
from twitter_favs
4 weeks ago
Twitter
Top: normal lettuce with olive oil
Bottom: bitter lettuce with soy sauce
(in Brazil soy sauce was a dressing option…
from twitter_favs
4 weeks ago
Twitter
View and review your GitHub PRs right in VS ! 🎉🙌
from twitter_favs
5 weeks ago
« earlier      
access addon ajax analytics android apache apex api apis aplix apple architecture archives archlinux argentina arm audio authentication aws backup bash bbc bios blog bluetooth bookmarks_bar boot broadband browser bts bugs build business c camera canvas charts checkout china chrome cognito community conference config configuration contacts cornwall css cycle cycling darwin dash data database debian debug delicious-export design desktop dev development device digital dns doc docker dooh dreamhost dwm dynamodb ecs editing email embedded encoding environment events example extension fcpx ffmpeg filesystem finland firefox flash flickr fonts food gadget gdata geo gis git github go golang google gps graphics gstreamer gtk hack hardware hash history hosting howto html html5 http i18n identity image immigration input intel internet iphone ipod irc iso8601 japan japanese java javascript jpeg2000 jquery js json keyboard kiosk korea korean language laptop linux live livecd location london macosx maemo mail management map maps microsoft mikrotik mobile monitoring mozilla mp3 music network networking news nodejs nokia npapi odf office offline ogg openid opensource opera oracle osx pdf performance php plugin plugins politics preseed presentation privacy programming prometheus python qa rails raspberrypi reference rpi2 s3 s60 scripting sdk search security shell signage singapore software southafrica spanish ssl standards startup statistics streaming surrey svg sysadmin systemd technology template terminal test testing text thinkpad tips tools toread touch trac travel tutorial twitter ubuntu uk unicode unix unlabeled up update upload usb video vim visualization vmware vuejs w3c web webconverger webdev webkit webpy whatwg widget widgets windows wireless woking wordpress worldcup06 x40 x61 xcode xml xorg

Copy this bookmark:



description:


tags: