- URL:
/weather
- Method: GET
- Description: Fetches today's weather in San Francisco using a weather API and returns it in JSON format.
- Usage: Send a GET request to
/weather
.
- URL:
/joke
- Method: GET
- Description: Returns a random joke in JSON format.
- Usage: Send a GET request to
/joke
.
- URL:
/fact
- Method: GET
- Description: Returns a random fact in JSON format.
- Usage: Send a GET request to
/fact
.
- URL:
/random-commit-message
- Method: GET
- Description: Returns a random commit message.
- Usage: Send a GET request to
/random-commit-message
.
- URL:
/random-lorem-ipsum
- Method: GET
- Description: Returns a random Lorem Ipsum text.
- Usage: Send a GET request to
/random-lorem-ipsum
.
- URL:
/random-user
- Method: GET
- Description: Returns a random user.
- Usage: Send a GET request to
/random-user
.
- URL:
/capital-city
- Method: GET
- Description: Returns a random capital city.
- Usage: Send a GET request to
/capital-city
.
- URL:
/_ping
- Method: GET
- Description: Returns "OK" to indicate the server is running.
- Usage: Send a GET request to
/_ping
.
-
Clone the repository:
git clone https://github.com/sneha-natekar/skillsettest.git cd skillsettest
-
Install Go: Follow the instructions on the official Go website to install Go on your machine: https://golang.org/doc/install
-
Build the server:
go build
- URL:
/weather
- Method: GET
- Description: Fetches today's weather in San Francisco using a weather API and returns it in JSON format.
- Usage: Send a GET request to
/weather
.
- URL:
/joke
- Method: GET
- Description: Returns a random joke in JSON format.
- Usage: Send a GET request to
/joke
.
- URL:
/fact
- Method: GET
- Description: Returns a random fact in JSON format.
- Usage: Send a GET request to
/fact
.
- URL:
/random-commit-message
- Method: GET
- Description: Returns a random commit message.
- Usage: Send a GET request to
/random-commit-message
.
- URL:
/random-lorem-ipsum
- Method: GET
- Description: Returns a random Lorem Ipsum text.
- Usage: Send a GET request to
/random-lorem-ipsum
.
- URL:
/random-user
- Method: GET
- Description: Returns a random user.
- Usage: Send a GET request to
/random-user
.
- URL:
/capital-city
- Method: GET
- Description: Returns a random capital city.
- Usage: Send a GET request to
/capital-city
.
- URL:
/_ping
- Method: GET
- Description: Returns "OK" to indicate the server is running.
- Usage: Send a GET request to
/_ping
.
-
Clone the repository:
git clone https://github.com/sneha-natekar/skillsettest.git cd skillsettest
-
Install Go: Follow the instructions on the official Go website to install Go on your machine: https://golang.org/doc/install
-
Build the server:
go build
-
Run the server:
./skillsettest
-
The server will be running at
http://localhost:8080
. You can now access the endpoints using the URLs provided above.
-
Ensure the server is running by following the steps in the "How to Run the Server" section.
-
Use a tool like
curl
, Postman, or your web browser to send GET requests to the endpoints. -
Example using
curl
:curl http://localhost:8080/weather curl http://localhost:8080/joke curl http://localhost:8080/fact curl http://localhost:8080/random-commit-message curl http://localhost:8080/random-lorem-ipsum curl http://localhost:8080/random-user curl http://localhost:8080/capital-city curl http://localhost:8080/_ping
-
Verify the responses to ensure they match the expected output as described in the "Endpoints" section.
-
Run the server:
./skillsettest
-
The server will be running at
http://localhost:8080
. You can now access the endpoints using the URLs provided above.