kreteshq / kretes Goto Github PK
View Code? Open in Web Editor NEWA Programming Environment for TypeScript & Deno
Home Page: https://kretes.dev/
License: Other
A Programming Environment for TypeScript & Deno
Home Page: https://kretes.dev/
License: Other
Hi, I really like what you do. But do not like it. The fact that you do not have a normal site with documentation. Can I help you in this matter?
Just a quick question, does it still make sense to use yarn? npm got better over the years. Or maybe that's just an error in the docs?
You also need to install yarn.
Hello there. So I've been playing around with this amazing library and everything seemed to be going so well but the it wasn't :D
So i connected huncwot with my Neo4j db and tried to fetch some data and it works well with browser but when i try to fetch call the GET request from Flutter/emulator it gives me an error.
On the Flutter DEBUG CONSOLE it prints an HTML response (which i don't know from where did it come from) and in the Huncwot consol it prints (undefined Internal Server Error)
Here's my Neo4j query function
static browseUserData() { return session.run('MATCH (u:USER) RETURN u.display_name AS name, u.bio AS bio') .then((res) => { return JSON.stringify(res.records, null, 3); }) .catch((error) => { console.error(error); }); }
And here's my Handler function from User folder i have a browse.ts file inside controller folder
const browse: Handler = async (): Promise<any> => { const user = await DatabaseEvents.browseUserData(); return OK(user); }
export = browse;
and here's my how i try to GET the data from Flutter
`var uri = 'http://1localhost:5544/user';
browseData() async {
http.Response response = await http.get(uri);
print(response.body);
}`
All of this works fine and as expected in a normal browser (Chrom in my case) but on Flutter it prints something else
This is what I get.
`flutter:
<title> </title> <style type="text/css"> /* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript&plugins=line-highlight+line-numbers+toolbar+show-language */ /** * prism.js default theme for JavaScript, CSS and HTML * Based on dabblet (http://dabblet.com) * @author Lea Verou */ code[class*="language-"], pre[class*="language-"] { color: black; background: none; text-shadow: 0 1px white; font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; text-align: left; white-space: pre; word-spacing: normal; word-break: normal; word-wrap: normal; line-height: 1.8; -moz-tab-size: 4; -o-tab-size: 4; tab-size: 4; -webkit-hyphens: none; -moz-hyphens: none; -ms-hyphens: none; hyphens: none; } pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, code[class*="language-"]::-moz-selection, code[class*="language-"] ::<…>`And this is what is printed on huncwot consol where i've started the sever.
`┌ GET /user → undefined Internal Server Error
└ Params
Error Cannot read property 'split' of undefined
Explanation
(missing)
Stack trace
P.S. I've tried with the approach of youtube where you store JSON data locally and extract it and it worked fine with flutter, but for Neo4j data, things seem to be different.
Thank you so much.
Best regards.
Hi @zaiste,
Firstly, I really like the idea behind this framework. If it evolves with the community around itself, we'll see interesting results for the framework in the near future, I think. Good work, @zaiste.
Maybe have an example of more complex usage of huncwot with a todo app or something would be nice. If no one is volunteer, I would be on it.
Cheers
Baris
lasso-body
-> include-javascripts
lasso-head
-> include-stylesheets
Currently, I'm getting an error when attempting to use the CLI to create a new project.
Specifically, what are the requirements for my environment? What version of Node? What version of NPM?
Please update the README with this information so I can quickly understand what to install before I use huncwot
.
It would be nice to have a npm run lint
script in package.json that would let you to use the default linter/prettifier. Right now it's not obvious how to run it.
Hey @zaiste!
Thank you very much for your beautiful framework! It just saved me a ton of time and helped me focus on actually building the API itself. I am using my API to upload files to the server as well and ran into this error:
Is there a way of fixing it or should I just ignore the error? Cuz' it seems to work anyways.
Edit: Just found out you already fixed it in this commit: c944078 Tried to update / reinstall huncwot but your change is still not present in the version I am able to pull from npm (0.52.0). I have now fixed it manually, but I am curious why this change isn't present in the newest npm version of the framework.
Edit 2: When creating a Project with hc new
package.json still contains Version 0.51.0. And Project install overwrites correct global install.
Edit 3: Found the reason for the issue! You missed committing the version update to /template/base/package.json (5faaeb0) before the new release commit (652f64f).
Kind regards
Lukas
routes.ts
🔽
import { Routes } from 'huncwot';
import { OK } from 'huncwot/response';
import { FSWatcher } from 'chokidar';
import { promises as fs } from 'fs';
import { join } from 'path';
const routes: Routes = {
GET: {
// implicit `return` with a `text/plain` response
'/hello': _ => 'Hello Huncwot',
// explicit `return` with a 200 response of `application/json` type
'/json': _ => {
return OK({ a: 1, b: 2 });
},
// set your own headers
'/headers': _ => {
return { body: 'Hello B', statusCode: 201, headers: { 'Authorization': 'PASS' } };
}
},
POST: {
// request body is parsed in `params` by default
'/bim': request => {
return `Hello POST! ${request.params.name}`;
},
'/upload': async ({ files }) => {
const { name, data } = files.foo;
const cwd = process.cwd();
await fs.writeFile(join(cwd, 'static', 'uploads', name), data);
return 'Uploaded';
}
}
};
export default routes;
Hello there.. so as always I'm still playing with the amazing Huncwot and this time it was with GraphQl.. although I wasn't able to achieve much with it. First, let us start with this code.
const { ApolloServer, gql } = require{'apollo-server'};
const neo4j = require{'neo4j-driver'};
const { makeAdugmentedScheme, inferSchema} = require{'neo4j-graphql-js'};
const dotenv = require{'dotenv'};
dotenv.config();
const uri = process.env.NEO4J_URI
const user = process.env.NEO4J_USER
const pass = process.env.NEO4J_PASSWORD
const driver = neo4j.driver(uri, neo4j.auth.basic(user, pass));
const context = {driver};
inferSchema(driver).then(({ typeDefs }) => {
const schema = makeAdugmentedScheme({ typeDefs });
const server = new ApolloServer({context, schema})
server.listen().then(({ url }) => {
console.log('Server ready at ${url}')
});
});
Starting by GraphQl
_how can I import it with Huncwot ?
_and how can I initialize the Server (ApolloServer / Huncwot server) with context and schema in it?
So basically these lines of code are what still confusing to me
const { ApolloServer, gql } = require{'apollo-server'};
I want to import Huncwot's GraphQl
const server = new ApolloServer({context, schema})
I want Huncwot server({}) and to listen to it.
I don't know if what I'm trying to achieve makes sense or not and if it is clear and possible.
Anyway, for me this is just the beginning of my journey with Graphql on Huncwot and probably there will be more to come.
Thanks again and best regards.
Hi @zaiste,
I am sorry to bother you again. I tried for hours to make it work, but I haven't found a way, even with pulling the whole ubuntu docker image and trying to install on it.
Dockerfile:
🔽
FROM node:lts-alpine
WORKDIR /home/node/app
COPY . .
RUN npm i -g huncwot
RUN npm install
CMD [ "huncwot", "server" ]
For context - my goal is to have two services run thru docker-compose, the huncwot api and a postgres database for the persitence layer. Maybe you have already found a successful way of making huncwot run in a docker environent.
Thanks in advance again for your help. I haven't thought that actually deploying my app on the server would be that challenging. 😕
Kind regards
@lukas-runge
Error Msg:
🔽
lukas@NetPort00:~/svc/openPlan_dev$ docker-compose build
Building huncwot-host
Step 1/6 : FROM node:lts-alpine
---> b0dc3a5e5e9e
Step 2/6 : WORKDIR /home/node/app
---> Using cache
---> 44791564cd2f
Step 3/6 : COPY . .
---> Using cache
---> 4f4df20d3e3f
Step 4/6 : RUN npm i -g huncwot
---> Running in 480b1edfd0d1
npm WARN deprecated [email protected]: Use @eivifj/dot instead
/usr/local/bin/huncwot -> /usr/local/lib/node_modules/huncwot/cli.js
/usr/local/bin/hc -> /usr/local/lib/node_modules/huncwot/cli.js
> [email protected] install /usr/local/lib/node_modules/huncwot/node_modules/argon2
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v72 ABI, musl) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/usr/local/lib/node_modules/huncwot/node_modules/argon2/lib'
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python checking if "python2" can be used
gyp ERR! find Python - "python2" is not in PATH or produced an error
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
gyp ERR! find Python (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python npm config set python "/path/to/pythonexecutable"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:307:47)
gyp ERR! stack at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:136:21)
gyp ERR! stack at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:179:16)
gyp ERR! stack at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:271:16)
gyp ERR! stack at exithandler (child_process.js:302:5)
gyp ERR! stack at ChildProcess.errorhandler (child_process.js:314:5)
gyp ERR! stack at ChildProcess.emit (events.js:223:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
gyp ERR! stack at onErrorNT (internal/child_process.js:456:16)
gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:81:21)
gyp ERR! System Linux 4.15.0-76-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/huncwot/node_modules/argon2/lib/binding/argon2.node" "--module_name=argon2" "--module_path=/usr/local/lib/node_modules/huncwot/node_modules/argon2/lib/binding" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /usr/local/lib/node_modules/huncwot/node_modules/argon2
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/huncwot/node_modules/argon2/lib/binding/argon2.node --module_name=argon2 --module_path=/usr/local/lib/node_modules/huncwot/node_modules/argon2/lib/binding --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/huncwot/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:223:5)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
node-pre-gyp ERR! System Linux 4.15.0-76-generic
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/huncwot/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/huncwot/node_modules/argon2
node-pre-gyp ERR! node -v v12.14.1
node-pre-gyp ERR! node-pre-gyp -v v0.13.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/huncwot/node_modules/argon2/lib/binding/argon2.node --module_name=argon2 --module_path=/usr/local/lib/node_modules/huncwot/node_modules/argon2/lib/binding --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm WARN [email protected] requires a peer of axios@^0.19.2 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/huncwot/node_modules/graphile-worker/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/huncwot/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
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! /root/.npm/_logs/2020-02-05T15_22_30_473Z-debug.log
ERROR: Service 'huncwot-host' failed to build: The command '/bin/sh -c npm i -g huncwot' returned a non-zero code: 1
Should this be locked?
https://github.com/huncwotjs/huncwot/blob/7b5c9553cbdc361d3399a3a1a3501f6f8f39819a/template/base/package.json#L7
I have installed huncwot globally today. My version is 0.53.1.
~/workspace/huncwot-test took 5s
⇝ huncwot --version
No YAML parser loaded. Suggest adding js-yaml dependency to your package.json file.
0.53.1
Yet, the project I have just initialized with huncwot new
has version 0.53.0 locked.
I just tried to start a PR to move @zerollup/ts-transform-paths to dependencies 😅
Currently, I'm getting the following error after creating a new huncwot
project from the CLI using huncwot new <folder-name>
:
An error occurred while trying to compile template at path "/path/name/to/my/project/node_modules/huncwot/components/include-stylesheets.marko". Error(s) in template:
1) [node_modules/huncwot/components/include-stylesheets.marko:1:0] Unrecognized tag: lasso-head - More details: https://github.com/marko-js/marko/wiki/Error:-Unrecognized-Tag
Node version: v8.9.3
huncwot new <folder-name>
, then cd <folder-name>
huncwot server
page
method should use streams in production; it uses render()
now to handle user friendly error messages
I'm playing with Huncwot and so far so good. I would like to ask you how can I retrieve a user's data by passing a keyword after parameters. For instance, in Twitter, if you pass a username after Twitter (Twitter.com/user) you will go to their profile page (eg; Twitter.com/Zaiste) and if you add the "followers" keyword after username it will take you to followers page and bring that user's followers data (eg; Twitter.com/Zaiste/followers) I can go to users page by creating a folder (User) and giving it Controllers (browse.ts, fetch.ts ...) but how about (Followers) section ? How can I make a URL link with user/followers and bring the same user's followers ?.
Thank you. Best regards.
Database name should be inherited from the application name at init
phase.
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.