-
Clone this repo
git clone https://github.com/EzlosSWM/todo-server.git
-
Navigate to the directory
cd todo-server
-
Download dependancies
go mod download && go mod verify
-
Run
- (make)
make live
- (Go)
go run *.go
- (make)
GET /todo
- Returns all todo items
GET /todo/{id}
- Returns the specified todo item
POST /todo
- Creates a new todo item
{
"todo": "test item"
}
DELETE /todo/{id}
- Deletes the selected item from the list of todo
PUT /todo/{id}
- Marks an item as completed
The database in use is PostgresSQL. The API will not run if you don't have a .env
in this root directory. You can use the template below:
-
Create .env file.
touch .env
-
Add environment variables to .env file
HOSTADDR=localhost
USER_NAME=
DB_NAME=
PASSWORD=
Note: for development puposes, HOSTADDR
is the localhost and should not be changed.
- The server runs on port 3000.
- The project is still in progress.
- Working on dockerizing.
- Wanting to return custom errors as json
make live
on the Makefile needs nodemon running to use;- Install nodemon using npm
npm install -g nodemon
- Install nodemon using npm
Once installed, make live
should work normally.
Twitter: @EzlosSWM
Github: @EzlosSWM
Email: ezlosswm@gmail.com