blog-go

command module
v0.0.0-...-a961985 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2021 License: MIT Imports: 5 Imported by: 0

README

Blog

Getting started

To get started with the app, first clone the repo and cd into the directory:

$git clone git@github.com:alexiscrack3/blog-go.git
$cd blog-go

Then install the needed packages:

$go get

Finally, run the test suite to verify that everything is working correctly:

$go test -v ./...

If the test suite passes, you’ll be ready to run the app in a local server:

$go run main.go

Endpoints

GET /posts
curl --location --request GET 'http://localhost:3000/posts'
GET /posts/:id
curl --location --request GET 'http://localhost:3000/posts/1'
POST /posts
curl --location --request POST 'http://localhost:3000/posts' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "Title",
"body": "lorem ipsum"
}'
PUT /posts
curl --location --request PUT 'http://localhost:3000/posts/1' \
--header 'Content-Type: application/json' \
--data-raw '{
    "title": "New Title",
    "body": "lorem ipsum"
}'
DELETE /posts/:id
curl --location --request DELETE 'http://localhost:3000/posts/3'
GET /users/:id/posts
curl --location --request GET 'http://localhost:3000/users/1/posts'

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
app

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL