Simple ReST API Using Go Lang
- A Simple ReST API using Go Lang
- Mux Router
- Currently data managed from memory
- Add Database Configuration
- Make architecture for Big One
Step 1: Install Go language on your machine.
Step 2: Clone this repository
git clone https://github.com/ManiruzzamanAkash/GoLang-Rest-API.gitStep 3: Go to that project, if you're on another directory.
Rename the folder to something else -
goapi-testGo to that folder -
cd goapi-testStep 4: Build App
go buildStep 5: Run
./goapi-testAll Books
URL: http://localhost:8000/api/books
Method: get
Get Single Book URL: http://localhost:8000/api/books/1
Method: get
Create a book -
URL: http://localhost:8000/api/books
Method: post
{
"Title" : "Book Created",
"Isbn": "819289823",
"Author": {
"FirstName": "Maniruzzaman",
"LastName": "Akash"
}
}Update a Book
URL: http://localhost:8000/api/books/2
Method: put
Where 2 is the ID
{
"Title" : "Book Updated for 2",
"Isbn": "819289823",
"Author": {
"FirstName": "Maniruzzaman",
"LastName": "Akash"
}
}Delete a Book
URL: http://localhost:8000/api/books/31847
Method: delete
Where 31847 is the ID