easy-rest-test
v0.1.0
Published
Get a basic REST service (for testing purposes) up an running in minutes.
Downloads
3
Readme
easy-rest-test
Get a basic REST service (for testing purposes) up an running in minutes.
Purpose
easy-rest-test enables you to provide a REST service within minutes based on a few given .csv files. Extend your REST service by just adding additional .csv files ...
Usage
There are only a few steps you need to follow:
- Clone the repository (
git clone [email protected]:stefanwalther/easy-rest-test.git
) - Do an
npm install
- Place the .csv file you want to expose through REST in the
./data/
folder. - Start the service by running
npm run start
Your .csv files are now exposed as a REST endpoint, e.g.:
- The content of the file
./data/sales-data.csv
- Is now available at
http://localhost:3000/sales-data
Endpoints
The following endpoints are available:
Reserved endpoints
<server-url>/health-check
- Health check for the entire service.<server-url>/api-docs
- Swagger / OpenAPI documentation (not implemented, yet).
Endpoints based on the files your are providing
For each of the datasets (right now only .csv files) you have provided, the following endpoints are exposed:
<server-url>/:dataset
- e.g. http://localhost:3000/sales-data for the file./data/sales-data.csv
.<server-url>/file/:dataset
- to download the entire file.
Deployment
The entire idea of this solution is to deploy a REST service with some basic data (e.g. for testing purposes) within less than a minute:
- Make sure you have a Heroku account
- Create a new heroku app
- Give it a name, e.g
my-rest-service
- Create the app (
Create app
) - Under your newly created app,
Deploy
, chooseDeployment method
and selectGitHub
- Enter the name of your GitHub repository and then click
Connect
- That's it, deploy your service by
Enable Automatic Deploys
or- manually using
Deploy Branch
- Access one of your data-sources by hitting e.g
https://my-rest-service.herokuapp.com/sales-data
File-Types
Right now only .csv
files are supported and placed into the ./data
folder.
Conventions for .csv files
- The .csv file contains a header
- The .csv file uses semicolon (
;
) as a delimiter
Roadmap
This is currently a very early iteration of the basic idea of "exposing .csv files through REST".
Any feedback is very appreciated!
So far the following additions are planned:
- [ ] (feat): Error handling in case of invalid .csv files
- [ ] (feat): Expose datasets via OpenApi/Swagger
- [ ] (feat): HATEOAS links
- [ ] (feat): In memory storage of datasets
- [ ] (feat): Support paging
- [ ] (feat): Support different authentication methods
- [ ] (ci): Docker Image
- [x] (ci): CircleCI Tests
- [ ] (test): More integration tests
- [ ] (docs): Instructions how to deploy within minutes to heroku & Co.
- [ ] (test): Coverage report
About
Author
Stefan Walther
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. The process for contributing is outlined below:
- Create a fork of the project
- Work on whatever bug or feature you wish
- Create a pull request (PR)
I cannot guarantee that I will merge all PRs but I will evaluate them all.
License
MIT
This file was generated by verb-generate-readme, v0.6.0, on January 11, 2019.