https://github.com/spar/fakerest
Fake Rest Repository with already available data to play around
https://github.com/spar/fakerest
csharp fake net rest rest-api
Last synced: 2 months ago
JSON representation
Fake Rest Repository with already available data to play around
- Host: GitHub
- URL: https://github.com/spar/fakerest
- Owner: spar
- License: mit
- Created: 2017-06-01T00:22:33.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2023-03-03T05:52:39.000Z (over 3 years ago)
- Last Synced: 2025-03-26T01:34:20.663Z (over 1 year ago)
- Topics: csharp, fake, net, rest, rest-api
- Language: JavaScript
- Homepage:
- Size: 1.1 MB
- Stars: 1
- Watchers: 0
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fake Rest
Fake Rest Repository with already available data to play around.
## Available Datasets
* Users
* Jeopardy Questions
* Nasa Facilities (Nasa Open Data)
* Nasa Patents (Nasa Open Data)
## Live Version
http://fakerest.sparekh.com/
## Adding a new Json Dataset
* Add the new Json file with name conventions : **EntityName**JsonData.json
* Make sure the Json sturcture of the entity has an Id field.
* Create a new class in Models folder with the same **EntiyName** as in the name of json dataset file.
* Derive the new class from BaseClass and implemnt GetSearchableText method. This methods returns a string made of Searchable fields and used by search function.
* Add a new Controller for the Entity and derive it from BaseController
* Provide proper route the access the new controller and that's all. The BaseController has all the Logic to handle requests.
## User Class Example
```
public class User : BaseClass
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public string Gender { get; set; }
public string Avatar { get; set; }
public override string GetSearchableText()
{
return Id + FirstName + LastName + Email + Gender;
}
}
```
## User Controller Example
```
[RoutePrefix("api/user")]
public class UserController : BaseController
{
}
```