the new open source catalogue of computer exercises
Like Open Educational Resources, Source Code offers the possibility for educational teams to
collaborate on the problem of creating and sharing exercises.
The latter consists in referencing IT resources, by allowing a diverse audience to benefit from all contributions.
As the catalogue expands, it will become an essential resource for all.
- PostgreSQL 12
- Node.js 10+
For more examples and API details, see API documentation (or build it yourself !)
- Install dependencies
npm install
- Creates a database (settings are stored in
config/config.js
)
npx sequelize db:create
- Creates the schema
exercises_library
in this database and
Apply all Sequelize migrations to let Sequelize initialize your models in database :
npm run setUp
This API is delivered with a very complete CLI tool to handle the different possible situations. You will find more information on its documentation.
npm start
This will start the API that you reach on http://localhost:3000.
Using openapi-generator :
npx openapi-generator generate -g typescript-axios -i api.yml -o out
Using redoc-cli:
npx redoc-cli bundle api.yml -o docs/index.html
Using openapi-generator :
npx openapi-generator validate -i api.yml
Using speccy :
npx speccy resolve api.yml -o spec-output.yaml
You can customize some parts of the API using the following environment variables :
Environment variable name | Purpose | Default value |
---|---|---|
PORT | The port to use for the API | 3000 |
TOKEN_TTL | A zeit/ms string that expresses in how much time a JWT token should expire | '1h' |
SECRET_PHRASE | The secretOrPrivateKey for jwt.sign | "Super secured passphrase" |
DEBUG | To print relevant logs using debug. Currently, you have the following choices : - sourcecode_api:error_handler : Print all errors - sourcecode_api:error_tracker : Print only failed requests errors - sourcecode_api:files : Print only files that couldn't deleted - sequelize:* : Print sequelize logs ... |
|
DATABASE_URL | The postgresql connection URI ( See postgresl docs for more information ) | |
DATABASE_SCHEMA | The schema we want to use on the database | |