https://github.com/luispagarcia/serverless-golang-api
Golang api example, using serverless framework, AWS API Gateway and Lambda functions
https://github.com/luispagarcia/serverless-golang-api
api get go golang post serverless
Last synced: 6 months ago
JSON representation
Golang api example, using serverless framework, AWS API Gateway and Lambda functions
- Host: GitHub
- URL: https://github.com/luispagarcia/serverless-golang-api
- Owner: LuisPaGarcia
- Created: 2018-06-06T16:47:56.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-06T20:59:10.000Z (almost 8 years ago)
- Last Synced: 2025-02-01T00:41:22.496Z (about 1 year ago)
- Topics: api, get, go, golang, post, serverless
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# serverless-golang-api
Golang api example
How to create two functions to POST and GET info with golang, aws and serverless framework.
### Prereq
1. You'll need NPM installed. [How to install NPM](https://www.npmjs.com/get-npm).
1. You'll need serverless framework installed.
```sh
$ npm i serverless -g
```
3. You'll need to have your serverless credentials added, you can see this video [Set Serverless cretenials 4min](https://www.youtube.com/watch?v=HSd9uYj2LJA)
### Ready
MacOS & Linux
```sh
$ git clone https://github.com/LuisPaGarcia/serverless-golang-api.git
$ cd serverless-golang-api
$ make
$ sls deploy
```
Windows
```cmd
> git clone https://github.com/LuisPaGarcia/serverless-golang-api.git
> cd serverless-golang-api
> dep ensure
> go build -s -w -o bin/hello hello/main.go
> go build -s -w -o bin/get get/main.go
> sls deploy
```
Restult
```sh
endpoints:
POST - https://ajshdjashdjaskh.execute-api.us-east-3.amazonaws.com/dev/hello
GET - https://ajshdjashdjaskh.execute-api.us-east-3.amazonaws.com/dev/get
functions:
hello: myservice-dev-hello
get: myservice-dev-get
```
You can test yout endpoints with [Postman](https://www.getpostman.com/)