Barca CLI is a project generator written in GO and its purpose is to build and configure HTTP servers, web proxy, SPA/PWA, Blog and custom landing page. It's easy, fast and productive.
Français · 简体中文 · Español · русский . 日本語 · Deutsch · Italiano · 한국어 . Українська . Português Brasileiro .
CLI (Command-Line Interface) is an environment where users can enter command lines to perform tasks in operating systems or in programming jobs.
Downloads all modules in the file to the local cache
go mod download
Run go run main.go
with argument --help
to list all CLI commands and flags
Example:
go run main.go --help
To build an HTTP Web Server, let's mention init
and api
arguments to start a simple Rest API.
Example:
go run main.go init api <project-name>
You can translate barca-cli resource messages by specifying after --lang
flag
Example:
go run main.go --lang francais init api <project-name>
It is very simple to generate an API with Barca CLI, with a few commands you will allow the construction of the project the way you want.
The following is an example of how to generate a REST API in Node.js and configure your environment.
1. Web Server 2. Controllers, Routes & Models 3. Database
Let's mention flags to configure the project, this is an example using the Express.js framework as a server running on port 4200.
go run main.go --framework express --port 4200 init api <your-project>
go run main.go --language francais --framework express --port 4200 init api <your-project>
After building the server, let's add models to our project, specify the Database type that will be used with the --database
flag and the table/collection with --collection
. In the following example it is showing how to insert a user model for Database MySQL
go run main.go --database mysql --collection users add model <your-project>
Now we need to inform by flags the settings to access and connect to our server MySQL
go run main.go --dbname testdb --host 127.0.0.1 --user root --password 12345 integrate mysql <seu-projeto>