-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement LiteREST: A lightweight SQLite-based REST API #10
Conversation
Love this. A couple of thoughts I'm just going to tag here to keep track of:
Overall very much on board with having a built in REST API interaction layer built right on top of the database for those who don't have complex querying use cases. Future considerations may be optionally allowing this to be deployed independently on its own worker binded to the same DO resource. At the same time though, this is lightweight enough where it won't impact anything for the users. |
Worked with Brandon on refactoring some of the code and utilizing some recently added helper functions for properly enqueueing requests. Below are some test cURLs to verify functionality. GETFetch data from the database. EqualsGet any entry that matches the column named
Not EqualsGet any result that does NOT equal the provided value.
LIKEThe URL has
INGet all results that match the names in the IN criteria, which the example below includes
Greater Than
Greater Than or Equal
Less Than
Less Than or Equal
SORT BY & ORDER
LIMIT & OFFSET
A bit of everything
POST
DELETE
PUTA PUT command is to do a FULL replacement of the entry in the table. For partial updates see PATCH
PATCHA PATCH command is to do a PARTIAL replacement of the entry in the table. For full updates see PUT
|
LiteREST: SQLite API
This is a small API for SQLite. It's like PostgREST, but simpler because well it's for SQLite.
What it does:
How it works:
What's next:
Testing the REST
1. Test the POST Endpoint:
Expected Result:
A successful response with the message "Resource created successfully" and the inserted data.
2. Test the GET Endpoint:
Expected Result:
A list of users, including the newly inserted user.
3. Test the PATCH Endpoint:
Expected Result:
A successful response with the message "Resource updated successfully" and the updated data.
4. Test the DELETE Endpoint:
Expected Result:
A successful response with the message "Resource deleted successfully".
I've tested each operation manually. However, we should add some automated tests next.
Let me know what you think. Is this useful? What would you change?