SparkEd is a responsive cross-browser software that helps you organize and present educational and training content, it supports different types of resources, v2 has been used in several schools in Ethiopia with more than 15000 resources on a single instance.
This is an initial graph representation of sparked-server The above graph is initial and doesn't contain all data, this is likely to be updated.
The following are examples of data of GraphQL queries and mutations
All the queries need to be authenticated, you can authenticate via a login mutation Register
mutation {
register(email: "olivier@gmail.com", password: "oL7vi3#") {
email
password
}
}
The password is hashed and never stored as plain text, the above mutation will return the email and a hashed password.
Login
mutation {
login(email: "olivier@gmail.com", password: "oL7vi3#")
}
The above mutation will give you results that include a token like this
{
"data": {
"login": "eyJhbGciOIkpXVCJ9.eyJ19pZCI6MzM2MDd9.trf9Rm-4w9nFBl4_gF1DfSTH2__xo"
}
}
You can then use the login token to pass it in headers as "authorization" to authentication any of the queries and mutations below
Adding a course
mutation {
addCourse(name: "Introduction") {
name
}
}
Querying courses
{
query {
getCourses {
_id
name
}
}
}
requirements
- Node ˆv6
- npm@latest
- MongoDb
Clone the repo
git clone https://github.com/OlivierJM/sparked-server.git
cd sparked-server
install dependencies
npm install
or yarn
create a file in the root of the project called .env
and add your contents as follows.
TOKEN="thegeneratedtoken"
URL= "http://localhost:3000/graphiql"
GRAPHQL_PORT = 3000
MONGO_PORT = 27017
MONGO_URL = "localhost"
dbName = "sparked"
SECRET = "yoursecretkey"
USER="user"
PASS="pass"
TEST_DB="test"
Running
npm dev
or yarn dev
Testing
yarn test
Contribution
Fork this repo and clone your forked repo
git clone https://github.com/your-github-username/sparked-server.git
Add this repo to your remotes as upstream.
git remote add upstream https://github.com/SparkEdUAB/sparked-server
Before pushing anything to your fork, always
git pull upstream
Don't forget to add the .env file mentioned above.
Note: Make sure all tests are passing and there are no lint errors before pushing, if you make changes to the code add the tests for that.
Thank you