CSVW Server is an express-based server that provides an interface to interact with data following the CSV on the Web (CSVW) format. It is designed to support various content negotiation options to deliver data in the most suitable format for the consumer.
- Features
- Installation
- Usage
- API Endpoints
- Content Negotiation
- Configuration
- Contributing
- License
- Contact
- Content Negotiation: Delivers data in various formats such as JSON-LD, CSV, JSON, and HTML based on the
Accept
header or query parameters. - Language Negotiation: Supports multiple languages for labels and descriptions based on the
Accept-Language
header. - Custom Rendering: Utilizes EJS templates for custom HTML rendering of data.
- Configurable: Easily configurable via environment variables.
To install CSVW Server, you need to have Node.js and npm installed on your system. If they are not installed, you can download and install them from the official Node.js website.
Once Node.js and npm are installed, you can install the CSVW Server using the following commands:
git clone https://github.com/theodi/csvw-server.git
cd csvw-server
npm install
You can configure the server using a .env
file. Here is an example configuration:
PORT=3000
HOST=localhost
BASE=http://example.com/
DATADIR=data/example4/
SECRET=MYSECRET
The BASE configuration variable specifies the root URL of your server. It also acts as the base prefix for your JSON-LD/CSVW data. This should be set to the domain you intend to serve data from, ensuring consistency between the server's domain and the identifiers used in your data.
DATADIR is the default directory from which to load the jsonld from and should contain a file called data.jsonsld
SECRET is the session secret for nodejs. Sessions hold the data the user is currently browsing and allows a single URI to have multiple versions of the same data.
To start the server, run:
npm start
By default, the server will run on port 3000. You can access it by visiting http://localhost:3000 in your browser.
GET /transactions/
: Fetches a list of all transactions.GET /transactions/:id
: Fetches a specific transaction by ID.
CSVW Server supports content negotiation to provide responses in various formats. You can request a specific format using the Accept
header in your HTTP request.
Supported formats:
application/ld+json
: JSON-LD format.text/csv
: CSV format.application/json
: JSON format.text/html
: HTML format.
Contributions to the CSVW Server project are welcome. Please check out our GitHub repository for more information on how to get involved.
CSVW Server is licensed under the MIT License. See the LICENSE.md file for more details.
For any questions or concerns, please open an issue on our GitHub repository, and we will get back to you as soon as possible.
Created and maintained by The Open Data Institute.