This project is developed based on CVWO sample app. The project now supports basic backend functionalities needed for a web forum application, where the frontend part can be referred here.
Download and install Go by following the instructions here.
- Fork this repo.
- Clone your forked repo.
- Open your terminal and navigate to the directory containing your cloned project.
- Run
go run cmd/server/main.goand head over to http://localhost:8000/users to view the response.
This is the main file structure. Note that this is simply one of various paradigms to organise your code, and is just a bare starting point.
.
├── cmd
│ ├── server
├── internal
│ ├── api # Encapsulates types and utilities related to the API
│ ├── dataacess # Data Access layer accesses data from the database
│ ├── database # Encapsulates the types and utilities related to the database
│ ├── handlers # Handler functions to respond to requests
│ ├── models # Definitions of objects used in the application
│ ├── router # Encapsulates types and utilities related to the router
│ ├── routes # Defines routes that are used in the application
├── README.md
├── go.mod
└── go.sum
Main directories/files to note:
cmdcontains the main entry point for the applicationinternalholds most of the functional code for your project that is specific to the core logic of your applicationREADME.mdis a form of documentation about the project. It is what you are reading right now.go.modcontains important metadata, for example, the dependencies in the project. See here for more informationgo.sumSee here for more information