Ditsmod codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.
This codebase was created to demonstrate a fully fledged fullstack application built with Ditsmod including CRUD operations, authentication, routing, pagination, and more.
This monorepository includes Ditsmod applications seed.
All packages are located in packages/* and are serviced by lerna and yarn workspaces.
From start you need:
- Clone the project
git clone https://github.com/ditsmod/realworld.git my-app
cd my-app- Bootstrap the project
yarn install
yarn boot # This command actually call "lerna bootstrap"- Copy
packages/server/.env-exampletopackages/server/.env:
cp packages/server/.env-example packages/server/.envAnd fill this file.
- Then create database (for example
real_world), grant access permissions for this database, and executeMySQL-dump from packages/server/sql/dump/info.sql.
yarn startAfter that, see OpenAPI docs on http://localhost:3000/api/openapi
yarn build
yarn start-prodTo run postman tests, you need to go through the four steps described above and start the web server.
After that execute:
yarn postman-testTo rerun the tests, first you need clear MySQL tables:
SET FOREIGN_KEY_CHECKS=0;
truncate curr_articles;
truncate curr_comments;
truncate curr_users;
truncate dict_tags;
truncate map_articles_tags;
truncate map_favorites;
truncate map_followers;
SET FOREIGN_KEY_CHECKS=1;Since this monorepo is served by yarn, it is necessary that any npm packages install via yarn.
If you want to add, for example, an Angular application, You can set yarn by default for angular-cli:
npm i -g add @angular/cli
ng config -g cli.packageManager yarnThen you can do this:
cd packages
ng new my-angular-application --routingFor some reason, a bug of yarn appears after this command. If you open http://localhost:3000/api/openapi you will see this bug. To avoid it, it is necessary delete yarn.lock and rebootstrap the monorepo:
yarn bootThen open packages/<your-project-name>/angular.json and fix $schema:
// ...
"$schema": "../../node_modules/@angular/cli/lib/config/schema.json",
// ...