Repository
Current version released
3 years ago
Dependencies
deno.land/x
skypack.dev
fastest-validator@^1.8.0
Versions
FUNQL
is Simply a new way to create web servers
What is FUNQL ?
funql is just a Native Graphql
- If you hate
gql
and prefer to handle backend tasks with standard and robust methods. - If you experience difficulties in using graphql in your projects due to its inherent complexities namely, time-consuming typesafety.
- Despite the simplicity of REST APIs, you are likely to get caught in the process of life-cycles and middlewares, etc.
- If you hate the secrets under the hood of libraries or frameworks.
- If you love MongoDB and want to use its potential capabilities.
funql Is For You
Funql Basics
funql
is just a sets of rules:
- You must send standard
JSON
’sHTTP POST
request tohttp://localhost:${PORT}/funql
- Your request should have
wants
object in it.wants
object should have 2 properties :model
anddoit
.model
is one of your MongoDB schemas anddoit
is one of your methods you write for that schema. - Your request should have
details
object in it,details
object should have 2 properties:set
andget
.
set
is a group of proprieties you try to send in a request like properties you need for creating a schema or properties you need to sort or filter on getting documents from schema.get
is an object to specify which fields client wants to retrieve.
- The structure of folders is quite important in a
funql
project
Folder structure example indeno
server:
- project
a blog example
- config
should have
- utils
maybe
- someUtils.ts
maybe
- index.ts
should have
- someUtils.ts
- db.ts
maybe
- redis.ts
maybe
- index.ts
should have
- utils
- src
should have
- utils
maybe
- populateMany.ts
maybe
- throwErr.ts
maybe
- index.ts
should have
- populateMany.ts
- functions
should have
- user
should have if we have an user schema
- funcs
should have if we have common fns
- getUsers.ts
maybe
- …
maybe
- index.ts
should have
- getUsers.ts
- adding.ts
maybe
- login.ts
maybe
- singing.ts
maybe
- getting.ts
maybe
- …
maybe
- index.ts
should have
- funcs
- …
other models fns
- index.ts
should have
- user
- schemas
should have
- utils
maybe
- someUtils.ts
maybe
- someOtherUtils.ts
maybe
- index.ts
should have
- someUtils.ts
- user.ts
maybe
- post.ts
maybe
- category.ts
maybe
- …
maybe
- index.ts
should have
- utils
- index.ts
should have
- utils
- index.ts
should have
- script.json
should have if use denon
- config
Basic rules
schemas
every schema should have 4 seprate things :
- an inteface to describe and hint
functions
Features
- It uses the best capabilities of graphql idea.
- It uses the best design elements of REST API’s.
- It removes all unnecessary extra code, validation, repetitive procedures.
funql
fully implementsfunctional programming
characteristics. Everything is comprised of small functionsfunql
is fundamentally based onfs(function schema)
architecture.
How to Install
- Firstly,
deno
must be installed. - After that just run this line:
to install latest version:
deno install -qAf --allow-read --allow-write --unstable https://deno.land/x/funql/funql.ts
to install specific version:
deno install -qAf --allow-read --allow-write --unstable https://deno.land/x/funql@{SPECIFIC_VERSION}/funql.ts
How to Use It
funql
, just enter this command
To start using funql --init [blog]
blog
is name of the project and for sake of simplicity, we create the blog project byfunql
becausefunql
is just a concept with set of rulesblog project
uses mongoDB and redis. So install them, we recommend using denon for running project so after installdenon
just run :
denon start
on the root of project directory.
After downloading dependencies, http://localhost:8000/
will be displayed on the console.
Now send this http request to retrieve data:
POST http://localhost:8000/funql HTTP/1.1
content-type: application/json
{
"wants": {
"model": "Country",
"doit": "adding"
},
"details": {
"set": {
"name": "iran",
"enName": "iran"
},
"get": {
"_id": 0,
"name": 0,
"cities": {
"_id": 1,
"name": 1
}
}
}
}
Todo
Language | Process | Description |
---|---|---|
Deno | 🔵 🔵 🔵 🔵 ⚪️ ⚪️ ⚪️ ⚪️ ⚪️ ⚪️ | just starting |
NodeJS | ⚪️ ⚪️ ⚪️ ⚪️ ⚪️ ⚪️ ⚪️ ⚪️ ⚪️ ⚪️ | nothing for know |
Golang | ⚪️ ⚪️ ⚪️ ⚪️ ⚪️ ⚪️ ⚪️ ⚪️ ⚪️ ⚪️ | nothing for know |
Rust | ⚪️ ⚪️ ⚪️ ⚪️ ⚪️ ⚪️ ⚪️ ⚪️ ⚪️ ⚪️ | nothing for know |