Skip to content

Commit

Permalink
Merge pull request #6 from Kovah/dev
Browse files Browse the repository at this point in the history
v2.1.0
  • Loading branch information
Kovah authored Jul 31, 2020
2 parents 20c60a4 + bee50dd commit 349b7e9
Show file tree
Hide file tree
Showing 8 changed files with 542 additions and 199 deletions.
4 changes: 4 additions & 0 deletions assets/dist/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 8 additions & 6 deletions assets/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ a:active {
@apply text-teal-200;
}

.content p {
position: relative;
}

.content p:after {
.paragraph:after {
content: 'Copied!';
position: absolute;
top: 0;
Expand All @@ -38,9 +34,15 @@ a:active {
transition: opacity 200ms ease;
}

.content p.success:after {
.paragraph.success:after {
opacity: 1;
}

.copy-paragraph:hover,
.sentence:hover {
@apply bg-teal-900;
outline: 2px solid #234e52;
}

@tailwind components;
@tailwind utilities;
8 changes: 7 additions & 1 deletion http.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
)

var bindHost string
var useEnvPort bool

type Output struct {
Source Source
Expand All @@ -25,13 +26,18 @@ func init() {
rootCmd.AddCommand(httpCmd)

httpCmd.Flags().StringVarP(&bindHost, "bind", "b", ":80", "Bind the HTTP server to a specific host and port, default is :80")
httpCmd.Flags().BoolVar(&useEnvPort, "env-port", false, "Bind the HTTP server to the port specified in the environment variable $PORT")
}

var httpCmd = &cobra.Command{
Use: "serve",
Short: "Run the DevLorem website as a HTTP server.",
Long: `Run the DevLorem website as a HTTP server. The HTTP server also serves the web API.`,
Run: func(cmd *cobra.Command, args []string) {
if useEnvPort {
bindHost = ":" + os.Getenv("PORT")
}

cmd.Printf("Starting HTTP server for DevLorem on %v...\n", bindHost)

if err := handleHttpServer(); err != nil {
Expand Down Expand Up @@ -71,7 +77,7 @@ func handleHttpServer() error {

// Handle the base webpage with generated paragraphs and show the paragraph tags in the results
r.HandleFunc("/p", func(w http.ResponseWriter, r *http.Request) {
source := GetRandomContent(true)
source := GetRandomContent(false)

output := Output{
Source: source,
Expand Down
Loading

0 comments on commit 349b7e9

Please sign in to comment.