-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ludwigsw
committed
May 8, 2024
0 parents
commit 82dbfa7
Showing
8 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: test | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: "26.0.2" | ||
gleam-version: "1.0.0" | ||
rebar3-version: "3" | ||
# elixir-version: "1.15.4" | ||
- run: gleam deps download | ||
- run: gleam test | ||
- run: gleam format --check src test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.beam | ||
*.ez | ||
/build | ||
erl_crash.dump |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# apero_webapp | ||
|
||
[![Package Version](https://img.shields.io/hexpm/v/apero_webapp)](https://hex.pm/packages/apero_webapp) | ||
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/apero_webapp/) | ||
|
||
```sh | ||
gleam add apero_webapp | ||
``` | ||
```gleam | ||
import apero_webapp | ||
pub fn main() { | ||
// TODO: An example of the project in use | ||
} | ||
``` | ||
|
||
Further documentation can be found at <https://hexdocs.pm/apero_webapp>. | ||
|
||
## Development | ||
|
||
```sh | ||
gleam run # Run the project | ||
gleam test # Run the tests | ||
gleam shell # Run an Erlang shell | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name = "app" | ||
version = "1.0.0" | ||
description = "A Wisp example" | ||
gleam = ">= 0.32.0" | ||
|
||
[dependencies] | ||
gleam_stdlib = "~> 0.30" | ||
wisp = { path = "../.." } | ||
gleam_erlang = "~> 0.23" | ||
mist = "~> 0.14" | ||
|
||
[dev-dependencies] | ||
gleeunit = "~> 1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import gleam/io | ||
|
||
pub fn main() { | ||
io.println("Hello from apero_webapp!") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import gleam/erlang/process | ||
import mist | ||
import wisp | ||
import app/router | ||
|
||
pub fn main() { | ||
// This sets the logger to print INFO level logs, and other sensible defaults | ||
// for a web application. | ||
wisp.configure_logger() | ||
|
||
// Here we generate a secret key, but in a real application you would want to | ||
// load this from somewhere so that it is not regenerated on every restart. | ||
let secret_key_base = wisp.random_string(64) | ||
|
||
// Start the Mist web server. | ||
let assert Ok(_) = | ||
wisp.mist_handler(router.handle_request, secret_key_base) | ||
|> mist.new | ||
|> mist.port(8000) | ||
|> mist.start_http | ||
|
||
// The web server runs in new Erlang process, so put this one to sleep while | ||
// it works concurrently. | ||
process.sleep_forever() | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import gleeunit | ||
import gleeunit/should | ||
|
||
pub fn main() { | ||
gleeunit.main() | ||
} | ||
|
||
// gleeunit test functions end in `_test` | ||
pub fn hello_world_test() { | ||
1 | ||
|> should.equal(1) | ||
} |