Advice forum backend in go


Advice forum backend in go

Good morning,

I'm planning to write a forum backend (basically just a rest api) in Go. This will be my very first project in Go with which I want to learn the language. I just want it to have the basics (register, login, open thread, answer to thread).

Now I have to structure the whole project and I can't seem to find the optimal structure for such a project so is there any advice on how to do this?

I'm currently thinking about something like this:

/config config.go /controllers users.go threads.go posts.go /http server.go /mysql connection.go database.go queries.go main.go 

This way I could easily switch out the different packages and the basic application would still work.

Are there any recommendations/improvements?

Submitted December 31, 2016 at 11:48PM by 9hR4
via reddit http://ift.tt/2hWGl1C

browserify doesnt work with chart.js?


browserify doesnt work with chart.js?

Hello stack overflow good morning,

im working on trying to use browserify with chartjs and i have this error were i get stuff pack but then when it reaches the point were is needs to make a graph it fails horribly this is my code inside bundle.js :

"browserfiy insert a function dont wanna copy over"

var input=require('./task.json'); const _ = require('underscore'); var dps = []; var found=0; for(var element in input) { found=0; for (var i=0;i<dps.length;i++){ if(dps[i].Technician===input[element].Technician){ console.log("name already exists"); dps[i].Count=dps[i].Count+1; found=1; } } if ( found === 0){ // only if we did not find ! dps.push({Technician: input[element].Technician, Count:1}); } } var data=[]; var datacount=[]; // dps.toJSON(); for ( var i = 0; i < dps.length; i++){ data.push(dps[i].Technician); } console.log(data); for ( var i = 0; i < dps.length; i++){ datacount.push(dps[i].Count); } console.log(datacount); var ctx = document.getElementById("linechart"); console.log(ctx); let linechart=new Chart(ctx,{ type:'bar', data: { labels: data, datasets: [ { label: "My First dataset", data: datacount } ] } } ); 

"my task.json file and wat not its meaningless for now"

and these are the errors i get in my console:

["UCH - Billy Metcalf", "Edward F. Dawson", "Dave Curl", "Laurence C Blotcky", "David A. Sutherland", "Hamilton Bonvillian", "Gina Smith", "Larry E. Robley", "Marco A. Gonzalez", "Onforce Techs", "PO Techs", "Justin Creech", "Charles Claypoole", "Harvey Self", "Nick Mauro", "Steve N. Lastic", "Shawn Arms", "Noemi Carrero", "John Weishaar", "Rory F. Morgan", "Bill A. Crane Jr.", "Nick Howard", "Brad Clapp", "Fix a Fax", "Technic", "Minet", "Tony Reece"] bundle.js:33 [33, 68, 29, 89, 53, 13, 61, 149, 20, 48, 28, 39, 24, 10, 32, 36, 28, 34, 19, 68, 86, 9, 12, 5, 3, 1, 3] bundle.js:37 null bundle.js:40 Uncaught ReferenceError: Chart is not defined at Object.1../task.json (bundle.js:40) at s (bundle.js:1) at e (bundle.js:1) at bundle.js:1 1../task.json @ bundle.js:40 s @ bundle.js:1 e @ bundle.js:1 (anonymous) @ bundle.js:1 main.js:1 Uncaught ReferenceError: require is not defined at main.js:1 

has anyone had this problem when using charjs and browserify or am i the just missing by a mile

Submitted December 31, 2016 at 11:12PM by hrvat25
via reddit http://ift.tt/2hEUPHt