thevahidal / soul Goto Github PK
View Code? Open in Web Editor NEW๐ A SQLite REST and realtime server
Home Page: https://thevahidal.github.io/soul/
License: MIT License
๐ A SQLite REST and realtime server
Home Page: https://thevahidal.github.io/soul/
License: MIT License
Hey, I saw your post on HN and was curious, and have a bunch of random feedback.
I followed the readme for getting things set up. However, I didn't have an sqlite db lying around, so i made an empty one.
Studio started on a different port than 3000, probably because I'm running a different dev server on 3000, so I got a cors error when running on this different port. Possibly set cors origins to allow * in dev?
Besides that running studio I got some semi-broken UI, probably because my db is empty, and errors in console. I fixed some of them locally but ended up getting too many retries (http) errors and ended up giving up ๐ญ
Anyways.. mostly a feedback around "maybe you should try to get it working with an empty db file" ?
Anyways, the concept is nice, good luck and keep it up
Describe the bug
I am trying to run a soul extension inside the soul/core
folder but the code is throwing an error in the /core/src/extensions.js
file, i have followed the instructions in here to run the extension.
To Reproduce
Go to the soul/core
folder and create a folder named _extensions
Create a file named api.js
inside the _extensions
folder and copy and paste the sample extension code from here
Add the path of your extension in your .env
file
EXTENSIONS=./_extensions
Run the project
npm run dev
Expected behavior
When i run the project, it throws an error in this line, it can't require
the _extensions/api.js
file,
Additional context
The code works fine when i modify the path of the extension like this
- const apiExtensions = require(`${extensionsPath}/${extension}`);
+ const apiExtensions = require(`../${extensionsPath}/${extension}`);
The combination of a react-admin
interface for a SQLite
backend could be a really lightweight solution to many problems. But, there isn't (yet) a REST wrapper for SQLite that is capable of integrating with react-admin
It now looks like soul
may be the missing component to getting this working. But, the Soul API needs to be extended, just a little:
https://marmelab.com/react-admin/DataProviderWriting.html#request-format
Following README starting soul fails on both Windows and Linux as follows:
โฏ soul -d sqlite.db -p 8000
/mnt/c/Users/marti/AppData/Roaming/npm/node_modules/soul-cli/soul/config/index.js:32
throw new Error(`Config validation error: ${error.message}`);
^
Error: Config validation error: "PORT" is required
It should be something similar to the fixtures
and loaddata
command in Django.
Thanks for creating this tool.
I'm just curious and want to know what this tool can be used.
Thanks for sharing.
Maybe instead of doing this, give the user to select which field to find object via that.
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Soul should accept relative paths for the extensions directory. e.g. ./_extensions/
Describe alternatives you've considered
Right now we can use absolute paths. e.g. /home/user/_extensions/
Additional context
_
Right now Soul has no structure, but we need to change it!
--
-- soul/
-- services/
-- controllers/
-- routes/
-- tables/
-- rows/
-- index.js
Is your feature request related to a problem? Please describe.
I'm trying to run react-admin
against a SQLite file wrapped in Soul
. But, I'm having CORS issues. I saw the .env.sample
file - containing the WHITELIST, and renamed it to .env
- but it didn't fix the issue. Yes, the URL in the file matches the actual origin (localhost:3000
) of my node server. Update: a few minutes later the CORS issue is resolved. Silly Ian mistakenly tried to modify the behaviour of an installed instance of Soul by modifying a file in a source repo. When I ran Soul from the repo the .env
trick worked perfectly :-)
I remain interested in the idea of running static content from within Soul
.
Describe the solution you'd like
One solution for the above would be for the Soul server to host static web content in a sub-folder. This would neatly prevent my CORS issues, and result in one less server process (node) running on my machine.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Hmm, on reflection would an extension
be a way to do this? We'd create an extension called root
, that serves index.html
from the root
folder. Would that do it @thevahidal ?
The repo readme refers to studio
, and how to start it. But, it doesn't explain the role of studio
.
A picture (well, screenshot) of soul studio
in the readme would paint a thousand words, IMHO.
Thanks. After upgrade it fails with:
PS C:\Users\marti\tmp\soul-test> soul -port 8080 -d sakila.db
C:\Users\marti\AppData\Roaming\npm\node_modules\soul-cli\src\config\index.js:43
throw new Error(`Config validation error: ${error.message}`);
^
Error: Config validation error: "NODE_ENV" is required
Originally posted by @maacl in #48 (comment)
A github repo is acting as an index
of libraries that expose HTML apis for databases:
https://github.com/dbohdan/automatic-api
An entry should be added for soul
.
When i run npm install
in the core folder, better-sqlite3
installation keeps failing due to node-gyp
To Reproduce
/soul/core
foldernpm install
Expected behavior
I was expecting all of the packages to be installed in the node_modules
folder so i can run the core API
OS
OS: macOS Ventura 13.0
Architecture: arm64
Node: v14.20.1
NPM: 6.14.17
MacBook-Pro โ npm install -g soul-cli
/Users/justin/.nvm/versions/node/v14.20.1/bin/soul -> /Users/justin/.nvm/versions/node/v14.20.1/lib/node_modules/soul-cli/soul/index.js
> [email protected] install /Users/justin/.nvm/versions/node/v14.20.1/lib/node_modules/soul-cli/node_modules/better-sqlite3
> prebuild-install || npm run build-release
prebuild-install warn install No prebuilt binaries found (target=14.20.1 runtime=node arch=arm64 libc= platform=darwin)
> [email protected] build-release /Users/justin/.nvm/versions/node/v14.20.1/lib/node_modules/soul-cli/node_modules/better-sqlite3
> node-gyp rebuild --release
TOUCH ba23eeee118cd63e16015df367567cb043fed872.intermediate
ACTION deps_sqlite3_gyp_locate_sqlite3_target_copy_builtin_sqlite3 ba23eeee118cd63e16015df367567cb043fed872.intermediate
TOUCH Release/obj.target/deps/locate_sqlite3.stamp
CC(target) Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o
LIBTOOL-STATIC Release/sqlite3.a
env: python: No such file or directory
make: *** [Release/sqlite3.a] Error 127
rm ba23eeee118cd63e16015df367567cb043fed872.intermediate
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/justin/.nvm/versions/node/v14.20.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:400:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
gyp ERR! System Darwin 22.1.0
gyp ERR! command "/Users/justin/.nvm/versions/node/v14.20.1/bin/node" "/Users/justin/.nvm/versions/node/v14.20.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /Users/justin/.nvm/versions/node/v14.20.1/lib/node_modules/soul-cli/node_modules/better-sqlite3
gyp ERR! node -v v14.20.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build-release: `node-gyp rebuild --release`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build-release script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/justin/.npm/_logs/2022-10-29T23_55_45_410Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `prebuild-install || npm run build-release`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/justin/.npm/_logs/2022-10-29T23_55_45_567Z-debug.log
To be able to be adapted to any needs, Soul needs to be extendable, because no matter how many built-in features it offers, eventually, people come with unique needs that the Soul can't and shouldn't have an answer for them.
For now, I'm thinking of three types of extensions:
/api/greeting
which returns a greeting message.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.