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
#[cfg(test)] | |
mod tests { | |
use super::*; | |
use actix_web::body::to_bytes; | |
use actix_web::dev::Service; | |
use actix_web::{http, test, web, App, Error}; | |
#[actix_web::test] | |
async fn test_say_hello() -> Result<(), Error> { | |
let app = App::new().route("/", web::get().to(say_hello)); |
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
use actix_web::{middleware, web, App, HttpRequest, HttpServer}; | |
async fn say_hello(req: HttpRequest) -> &'static str { | |
println!("REQ: {:?}", req); | |
"Hello world!" | |
} | |
#[actix_web::main] | |
async fn main() -> std::io::Result<()> { | |
std::env::set_var("RUST_LOG", "actix_web=info"); |
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
namespace Blog.Database.Entities; | |
public class BlogPost | |
{ | |
public int Id { get; set; } | |
public string Title { get; set; } = default!; | |
} |
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
using Blog.Database.Entities; | |
using Microsoft.EntityFrameworkCore; | |
namespace Blog.Database; | |
public class AppDbContext : DbContext | |
{ | |
public DbSet<BlogPost> Posts { get; set; } | |
protected override void OnConfiguring(DbContextOptionsBuilder options) |
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
Show hidden characters
{ | |
"name": "C# (.NET)", | |
"dockerComposeFile": [ | |
"../docker/docker-compose.yaml" | |
], | |
"service": "dev-env", | |
"workspaceFolder": "/workspace", | |
"settings": {}, | |
"extensions": [ | |
"ms-dotnettools.csharp", |
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
version: '3' | |
services: | |
database: | |
container_name: postgres | |
image: "postgres" | |
env_file: | |
- database/database.env | |
volumes: | |
- blog-database-data:/var/lib/postgresql/data/ | |
dev-env: |
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
{ | |
"name": "Existing Docker Compose (Extend)", | |
"dockerComposeFile": [ | |
"../docker-compose.yml", | |
"docker-compose.yml" | |
], | |
"service": "truffle_suite", | |
"workspaceFolder": "/workspace", | |
"settings": { | |
"terminal.integrated.shell.linux": null |
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
module.exports = { | |
networks: { | |
development: { | |
host: "ganache-cli", | |
port: 8545, | |
network_id: "57771", | |
}, | |
} | |
}; |
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
version: "3" | |
services: | |
# start the ganache cli container | |
ganache-cli: | |
container_name: ganache-cli | |
build: | |
context: ./docker/ganache-cli | |
# note host:container | |
ports: | |
- 5545:8545 |
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
FROM trufflesuite/ganache-cli:latest | |
RUN /bin/sh -c "apk add --no-cache bash" | |
ENTRYPOINT node /app/ganache-core.docker.cli.js --quiet --networkId 57771 --verbose --host 0.0.0.0 |
NewerOlder