Skip to content

Latest commit

 

History

History
56 lines (34 loc) · 1.5 KB

SERVER.md

File metadata and controls

56 lines (34 loc) · 1.5 KB

Feature: Server

The server feature provides a readonly RESTful API on port 8000

Example

Setup

You'll need the latest Rust nightly build.

NOTE: See README.md for information how to install rustup


Use

$ rustup install nightly

to install the latest nightly build.

You may also use.

$ rustup default nightly

Visit rustup.rs for more information.

NOTE: While I'm writing this documentation (Jan. 2018), i receive compilation errors. See Ring Issue #598 for a temporary fix.

Run

Run the following command to compile your project and make use of the server feature.

sh $ cargo +nightly run --bin asciii-server --features server

This will create an local instance of a Rocket server in port 8000.

Since rocket runs on port 8000 by default, your browser will block Cross-Origin request. You'll have to allow Cross-Origin requests to use the API.

HTTP Endpoints

Content-Type: application/json

  • GET /api/projects => all project identifiers
  • GET /api/projects/year => all years
  • GET /api/projects/year/<year> => all project identifiers of <year>
  • GET /api/projects/<identifier> => project with <identifier>
  • GET /api/full_projects => all projects
  • GET /api/full_projects/year/<year> => all projects of <year>