Browse Source

deleted server

master
Inderjit Gill 1 year ago
parent
commit
a630126738
5 changed files with 7 additions and 1600 deletions
  1. +0
    -1
      .gitignore
  2. +7
    -43
      README.md
  3. +0
    -1511
      server/Cargo.lock
  4. +0
    -10
      server/Cargo.toml
  5. +0
    -35
      server/src/main.rs

+ 0
- 1
.gitignore View File

@@ -1,6 +1,5 @@
/assets/research
/core/target
/server/target
/client/target
/client/www/sokoban_client.js
/client/www/sokoban_client_bg.wasm

+ 7
- 43
README.md View File

@@ -7,23 +7,16 @@ core : the core game code, independent of output format (native/web etc). Writte

client : the web version, a wrapper around the core crate that generates wasm and js files
build with:
$ npm run build:dev
$ cd client
$ ./build.sh

build release version with:
$ npm run build:release

the generated wasm and js files will be in client/www/wasm

client/www : an npm package that uses the generated wasm and js files to build a web app.
setup with:
$ npm install

dev with:
$ npm run start
build for production with:
$ npm run build
$ cd client
$ ./build.sh release

server : a separate rust codebase for serving the web app in client/www
launch a server in client/www
$ cd client/www
$ basic-http-server

(todo one day) native : a native build of Sokoban that wraps the core crate with a native sdk

@@ -33,33 +26,4 @@ $ rustup update
$ rustup install nightly
$ rustup target add wasm32-unknown-unknown --toolchain nightly
$ cargo +nightly install wasm-bindgen-cli
$ cd client/www
$ npm install
```
## during dev
in terminal 1:
```sh
$ cd client
$ npm run build:dev
```
in terminal 2:
```sh
$ cd client/www
$ npm run start
```
can now visit http://localhost:8080

changes to the rust code will require re-running the terminal 1 command:
```sh
$ npm run build:dev
```

## for 'release'
```sh
$ cd client
$ npm run build:release
$ cd client/www
$ npm run build
```

todo: ensure that everything required for release is in the client/www/dist directory

+ 0
- 1511
server/Cargo.lock
File diff suppressed because it is too large
View File


+ 0
- 10
server/Cargo.toml View File

@@ -1,10 +0,0 @@
[package]
name = "sokoban-server"
version = "0.1.0"
authors = ["Inderjit Gill <email@indy.io>"]

[dependencies]
env_logger = "0.5.4"

actix = "0.7"
actix-web = "^0.7"

+ 0
- 35
server/src/main.rs View File

@@ -1,35 +0,0 @@
extern crate actix;
extern crate actix_web;
extern crate env_logger;

use actix_web::http::{header, Method};
use actix_web::{
fs, middleware, server, App, HttpResponse,
};


fn main() {
::std::env::set_var("RUST_LOG", "actix_web=info");
env_logger::init();
let sys = actix::System::new("sokoban-server");

server::new(|| {
App::new()
// enable logger
.middleware(middleware::Logger::default())
// redirect
// .resource("/", |r| r.method(Method::GET).f(|_req| {
// HttpResponse::Found()
// .header(header::LOCATION, "../client/index.html")
// .finish()
// }))
// static files
.handler("/", fs::StaticFiles::new("../client/web").unwrap())
}).bind("127.0.0.1:8080")
.unwrap()
.shutdown_timeout(1)
.start();

println!("Started http server: 127.0.0.1:8080");
let _ = sys.run();
}

Loading…
Cancel
Save