In this case the project will separate to two folder
- Client
- Using React, SemanticUI
- Server
- Using Golang
- MongoDB
using React client
Then execute in command prompt:
$ cd client
$ npm install
$ npm run start
for server in go-server
GOTOD or Go-TodoApp is a Golang REST API made to show some Todo List.
Properties | Description | Type |
---|---|---|
Task | the giving name of activity | String |
Status | status activity was build | String |
Routes | HTTP Methods | Description |
---|---|---|
/api/task/ | GET | Displays all activity |
/api/task/ | POST | Creates a new activity |
/api/task/ | PUT | Update an activity was build |
/api/deleteAllTask/ | DELETE | Deletes all activity |
/api/undoTask/{id} | PUT | Update status of activity |
/api/deleteTask/{id}} | DELETE | Deletes a specific activity, given its id |
Project is created with:
- Golang
- gorilla/mux
- joho/godotenv
- MongoDB
To run this project locally, clone repo and add an .env
file in the root:
MONGODB_URI="MongoDB atlas URI connection string"
DB_NAME="your db want build"
DB_COLLECTION="name table you want build in mongo"
Then execute in command prompt:
$ cd go-server
$ go mod tidy
$ go run main.go
These are the endpoints available from the app
Returns result identity
Show example response
{
"data": [
{
"id":40,
"name":"hafizh",
"location": "widodo",
"age":22,
}
]
}
Creates a new identity
This request requires body payload, you can find the example below.
Show example payload
{
"name":"hafizh",
"location":"kansas",
"age":12
}
Returns a player by id
Show example response
{
"meta": {
"code": 200
},
"data": {
"id": "5f6a5c31d7c451c369802c02",
"name": "John Doe 1",
"nickname": "Lolo",
"position": "forward",
"created_at": "2020-09-22T20:18:57.957Z"
}
}
Returns a player by id
Show example response
{
"meta": {
"code": 200
},
"data": {
"id": "5f6a5c31d7c451c369802c02",
"name": "John Doe 1",
"nickname": "Lolo",
"position": "forward",
"created_at": "2020-09-22T20:18:57.957Z"
}
}
Update value of identity
Show example response
{
"name": "hafizah",
"location": "toronto",
"age": 25,
}
Update value of identity
Show example response
{
"name": "hafizah",
"location": "toronto",
"age": 25,
}