{"_id":"@aciiverse/generator-aciifx","_rev":"4-7a35054655568aab62e008ba072cb310","name":"@aciiverse/generator-aciifx","dist-tags":{"latest":"1.2.0"},"versions":{"1.0.0":{"name":"@aciiverse/generator-aciifx","version":"1.0.0","keywords":["template","generator","api","express","acii"],"author":"","license":"MIT","_id":"@aciiverse/generator-aciifx@1.0.0","maintainers":[{"name":"flowtastisch","email":"hey@aciiverse.com"}],"homepage":"https://github.com/Aciiverse/generator-aciiFX#readme","bugs":{"url":"https://github.com/Aciiverse/generator-aciiFX/issues"},"dist":{"shasum":"ca96032047fc72906a9348945955acfcfc2d67a6","tarball":"https://registry.npmjs.org/@aciiverse/generator-aciifx/-/generator-aciifx-1.0.0.tgz","fileCount":29,"integrity":"sha512-rtwPrbwC5aPcykdvfhbTPMFWqYXMECwV6eWIS87rhplkC3aOuTdUoxN9pfzmlgdNizW1tjUDs/N81CwAz7cA8Q==","signatures":[{"sig":"MEUCIQCrCOjUFgejRmPwXS6QSBPy6oyKvWPJ7Rzuz0p1V7RVFQIgW6PUAkTIwnVmjcDKaYUx0kLTN6WkU1/xrckZm2cW+1Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":55723},"jest":{"testEnvironment":"node"},"main":"generators/index.js","type":"module","gitHead":"960955fd2216967cf6c08e3376505ffcd98bf3a9","scripts":{"test":"jest"},"_npmUser":{"name":"flowtastisch","email":"hey@aciiverse.com"},"repository":{"url":"git+https://github.com/Aciiverse/generator-aciiFX.git","type":"git"},"_npmVersion":"10.8.2","description":"aciiFX generator","directories":{},"_nodeVersion":"20.16.0","dependencies":{"jest":"^29.7.0","yosay":"^3.0.0","yeoman-assert":"^3.1.1","yeoman-generator":"^7.3.2","yeoman-environment":"^4.4.1"},"_hasShrinkwrap":false,"devDependencies":{"prettier":"^3.3.3","@types/jest":"^29.5.12","@types/yosay":"^2.0.3","@types/yeoman-assert":"^3.1.4"},"_npmOperationalInternal":{"tmp":"tmp/generator-aciifx_1.0.0_1728585951260_0.7180381232004658","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"@aciiverse/generator-aciifx","version":"1.1.0","keywords":["template","generator","api","express","acii"],"author":"","license":"MIT","_id":"@aciiverse/generator-aciifx@1.1.0","maintainers":[{"name":"flowtastisch","email":"hey@aciiverse.com"}],"homepage":"https://github.com/Aciiverse/generator-aciiFX#readme","bugs":{"url":"https://github.com/Aciiverse/generator-aciiFX/issues"},"dist":{"shasum":"d069b475f74b814fb9ba3ad4a8044a0cb4090238","tarball":"https://registry.npmjs.org/@aciiverse/generator-aciifx/-/generator-aciifx-1.1.0.tgz","fileCount":27,"integrity":"sha512-HnNGl7jfhZ6zyJwkoEaWs37yVzSromezOMjAGSfZsnCY7bPUr7cUYLziCtmMNy5pHggl17ZJl3tHy+pHxrZryA==","signatures":[{"sig":"MEYCIQD9R+8F8ndxUkEJpqW24wll94umApc4ejDUDPwqj3duJwIhAOMH9bGTn5L4/EsS4IcrusRnUa95PHmYRKOb5RPFCLKc","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":55165},"jest":{"testEnvironment":"node"},"main":"generators/index.js","type":"module","gitHead":"ebdc39cf5e3fde557db6ae294e1253b4b5e70891","scripts":{"test":"jest"},"_npmUser":{"name":"flowtastisch","email":"hey@aciiverse.com"},"repository":{"url":"git+https://github.com/Aciiverse/generator-aciiFX.git","type":"git"},"_npmVersion":"10.9.0","description":"aciiFX generator","directories":{},"_nodeVersion":"22.11.0","dependencies":{"jest":"^29.7.0","yosay":"^3.0.0","yeoman-assert":"^3.1.1","yeoman-generator":"^7.3.3","yeoman-environment":"^4.4.3"},"_hasShrinkwrap":false,"devDependencies":{"prettier":"^3.3.3","@types/jest":"^29.5.14","@types/yosay":"^2.0.3","@types/yeoman-assert":"^3.1.4"},"_npmOperationalInternal":{"tmp":"tmp/generator-aciifx_1.1.0_1732215554706_0.6593814714735433","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"@aciiverse/generator-aciifx","version":"1.2.0","keywords":["template","generator","api","express","acii"],"author":"","license":"MIT","_id":"@aciiverse/generator-aciifx@1.2.0","maintainers":[{"name":"flowtastisch","email":"hey@aciiverse.com"}],"homepage":"https://github.com/Aciiverse/generator-aciiFX#readme","bugs":{"url":"https://github.com/Aciiverse/generator-aciiFX/issues"},"dist":{"shasum":"e4529e3ce2684b6e0325d40dc97819503a5fefa6","tarball":"https://registry.npmjs.org/@aciiverse/generator-aciifx/-/generator-aciifx-1.2.0.tgz","fileCount":28,"integrity":"sha512-smkLavwRg/TT9ioT8Ae8Dcq8TOCjp9dKQvRDbzU1X04TRrJST4AKRF2RIz/rb7ViHHOcrZTTGTBxPSzYSEVaNA==","signatures":[{"sig":"MEUCIQC5vKUMAFazZ1ylPrNZUOpN8tN2q6Ta9nGqPhQ+e35a5gIgHzsXWlpvKBV7kGETKlafXqelfB2rsF7aZd6DFWTRLQo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":57915},"jest":{"testEnvironment":"node"},"main":"generators/index.js","type":"module","gitHead":"1ae71f6f33dbc5f649dc3915a7e09e018dd7d422","scripts":{"test":"jest"},"_npmUser":{"name":"flowtastisch","email":"hey@aciiverse.com"},"repository":{"url":"git+https://github.com/Aciiverse/generator-aciiFX.git","type":"git"},"_npmVersion":"10.9.1","description":"aciiFX generator","directories":{},"_nodeVersion":"22.11.0","dependencies":{"jest":"^29.7.0","yosay":"^3.0.0","yeoman-assert":"^3.1.1","yeoman-generator":"^7.3.3","yeoman-environment":"^4.4.3"},"_hasShrinkwrap":false,"devDependencies":{"prettier":"^3.3.3","@types/jest":"^29.5.14","@types/yosay":"^2.0.3","@types/yeoman-assert":"^3.1.4"},"_npmOperationalInternal":{"tmp":"tmp/generator-aciifx_1.2.0_1739867686424_0.6876403752092319","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2024-10-10T18:45:51.150Z","modified":"2025-08-23T09:52:23.299Z","1.0.0":"2024-10-10T18:45:51.457Z","1.1.0":"2024-11-21T18:59:14.916Z","1.2.0":"2025-02-18T08:34:46.616Z"},"bugs":{"url":"https://github.com/Aciiverse/generator-aciiFX/issues"},"license":"MIT","homepage":"https://github.com/Aciiverse/generator-aciiFX#readme","keywords":["template","generator","api","express","acii"],"repository":{"url":"git+https://github.com/Aciiverse/generator-aciiFX.git","type":"git"},"description":"aciiFX generator","maintainers":[{"email":"hey@aciiverse.com","name":"flowtastisch"},{"email":"noreply@aciiverse.com","name":"flwcii"}],"readme":"# generator-aciiFX\r\n\r\n> Simple & Powerful Aciiverse NodeTS Backend\r\n\r\n> [Hier](/README.de.md) ist die Doku ebenfalls in deutsch.\r\n\r\n## Developer\r\n\r\n-   [Flowtastisch](https://github.com/flowtastisch)\r\n\r\n## Credits\r\n\r\n### generator-aciiFX\r\n\r\n-   [bcryptjs](https://github.com/kelektiv/node.bcrypt.js)\r\n-   [concurrently](https://github.com/open-cli-tools/concurrently)\r\n-   [cors](https://github.com/expressjs/cors)\r\n-   [dotenv](https://github.com/motdotla/dotenv)\r\n-   [express](https://github.com/expressjs/express)\r\n-   [javascript](https://www.javascript.com/)\r\n-   [jsonwebtoken](https://github.com/auth0/node-jsonwebtoken)\r\n-   [prettier](https://github.com/prettier/prettier)\r\n-   [uuid](https://github.com/uuidjs/uuid)\r\n-   [typescript](https://github.com/Microsoft/TypeScript)\r\n\r\n### aciiFX-CLI\r\n\r\n-   [express](https://github.com/expressjs/express)\r\n-   [mariadb](https://github.com/sidorares/mariadb)\r\n-   [prettier](https://github.com/prettier/prettier)\r\n-   [typescript](https://github.com/Microsoft/TypeScript)\r\n\r\n### Additionally for the yo generator\r\n\r\n-   [coveralls](https://github.com/nickmerwin/node-coveralls)\r\n-   [jest](https://jestjs.io/)\r\n-   [yeoman](https://yeoman.io/)\r\n\r\n### Additionally for the demo app\r\n\r\n-   html5\r\n-   css3\r\n\r\n## Features\r\n\r\n-   simple and powerful **api basic framework**\r\n-   **user system** with middleware\r\n-   simple & modular **translation module**\r\n-   types from backend to frontend (**Types2FrontendApp**)\r\n\r\n## Generate your own project\r\n\r\n### What you need\r\n\r\n-   NodeJS (>= vXX)\r\n-   TypeScript `npm install -g typescript`\r\n-   Erreichbare MySQL Datenbank\r\n\r\n### Installation\r\n\r\n1.  Install Yeoman\r\n\r\n        npm install -g yo\r\n\r\n2.  Install the aciiFX-CLI generator\r\n\r\n        npm i -g @aciiverse/generator-aciifx-cli\r\n\r\n3.  The following options are available for a more detailed selection\r\n\r\n-   **demo directory:** Only install it if you want to test aciifx. It generates you a simple html page that should show the main functions of aciiFX.cli. Open the `./demo/index.html` file inside your browser.\r\n\r\n4.  Perform the generator in your desired folder (!Attention The generator generates its own folder in your folder!)\r\n\r\n        yo @aciiverse/aciifx-cli\r\n\r\n5.  Now run the command `npm run start:dev` or alternatively you can go to the `package.json` and find the command `start:dev` at `scripts`\r\n\r\n## Develop with aciiFX\r\n\r\n> You develop in the `./aciiFX/src/` directory\r\n\r\n> Here are a few examples of how to use the functions:\r\n\r\n### Routes\r\n\r\n#### New Route (Modules)\r\n\r\nTo create a new route, create a new typecript file. Put the new file as follows: `./aciiFX/src/lib/route/{your route}.route.ts`. Replace {your route} with your desired route. Here are a few examples _(The `/service` route is an exception)_:\r\n\r\n| Module | Route                 | File           | Usecase                          |\r\n| ------ | --------------------- | -------------- | -------------------------------- |\r\n| Users  | /users/login          | users.route.ts | Login the Users                  |\r\n| Users  | /users/register       | users.route.ts | Register the user                |\r\n| Games  | /games                | games.route.ts | Display of all games             |\r\n| Games  | /games/:id            | games.route.ts | Display of a game                |\r\n| Games  | /games/:id/scoreboard | games.route.ts | Display of the points of a game  |\r\n| Games  | /games/:id/players    | games.route.ts | Display of the players of a game |\r\n\r\n#### The content of your routing file should look initially as follows (for example: `games.route.ts`):\r\n\r\n    import express = require(\"express\");\r\n    import { db } from \"../db\";\r\n\r\n    const router = express.Router();\r\n\r\n    router.get(\"/\", (req: express.Request, res: express.Response) => {\r\n        // Handles GET \"/games\"\r\n    });\r\n\r\n    router.get(\"/game/:id\", (req: express.Request, res: express.Response) => {\r\n        // Handles GET \"/game/1\", \"/game/2\", \"/game/3\", etc...\r\n    });\r\n\r\n    module.exports = router;\r\n\r\n#### Route output (Return) :\r\n\r\n> A few examples of how you can hand over to Express data to the frontend\r\n\r\n-   A standard output only with a message:\r\n\r\n        res.status(202).send({\r\n            message: \"Success\",\r\n        });\r\n\r\n-   An output with message and file:\r\n\r\n        const result = [\r\n            {\r\n                id: 1,\r\n                name: \"Assassin's Creed Shadows\"\r\n            },\r\n            {\r\n                id: 2,\r\n                name: \"Assassin's Creed Valhallah\"\r\n            }\r\n        ];\r\n\r\n        res.status(202).send({\r\n            message: \"Success\",\r\n            data: result\r\n        });\r\n\r\n-   An image or other file (saved as a blob):\r\n\r\n        const image = {\r\n            data: <...>,\r\n            type: 'image/png'\r\n        }\r\n\r\n        res.setHeader('Content-Type', image.type);\r\n        res.end(image.data, 'binary');\r\n\r\n### API Types (Types2FrontendApp)\r\n\r\nYou can automatically make your API types (Request and Response) available for the frontend.\r\n\r\n1. Create all the requests and response types in `./aciiFX/src/lib/types/api.types.ts`.\r\n   The name convention of the types is as follows: `{Request Art (Get, Post, Put, Delete)}{Name der Route}{Req oder Res}` For example: `GetUsersLoginReq`. This includes the following types:\r\n\r\n-   Request Types: All types that map the body data that you get from the frontend:\r\n\r\n        const body: GetUsersLoginReq = req.body;\r\n\r\n-   Response types: All types that are sent to the frontend:\r\n\r\n        return res.status(200).send({\r\n                <Deine Daten>\r\n        } as GetUsersLoginRes);\r\n\r\n2. To make the guys accessible, carry out the command `npm run export:types`\r\n3. Now the folder `./apiTypes` is generated. These types can now simply be imported from the frontend like modules.\r\n\r\n### Translation module (Lang)\r\n\r\nTo always get the current language, you can use the lang module.\r\n\r\n-   In the folder `./aciiFX/lang` you will find .json files. You can add your own for e.g. french -> `fr.lang.json`\r\n-   In the .env file you set a standard language.\r\n-   Which text is taken first is decided as follows:\r\n    1. the language that is given to the function\r\n    2. the language that is defined in the `.env` (`FX_LANG_DEFAULT_LANGUAGE`)\r\n    3. english `en.lang.json`\r\n-   You can get a text as follows:\r\n\r\n        // In config file: { \"err.test\": \"Hello World!\" }\r\n        const text = lang.getText(\"err.test\");\r\n        console.log(text);\r\n        // Hello World!\r\n\r\n-   You can also give values as an string:\r\n\r\n        // In config file: { \"err.test\": \"Hello {0}!\" }\r\n        const text = lang.getText(\"err.test\", { values: \"Ezio\" });\r\n        console.log(text);\r\n        // Hello World!\r\n\r\n    or as an array:\r\n\r\n        // In config file: { \"err.test\": \"Hello {0} {1}!\" }\r\n        const text = lang.getText(\"err.test\", { values: [\"Ezio\", \"Auditore\"] });\r\n        console.log(text);\r\n        // Hello Ezio Auditore!\r\n\r\n-   The requested language can also be defined with `options`:\r\n\r\n        // In de.lang.json config file: { \"err.test\": \"Hello World!\" }\r\n        // In en.lang.json config file: { \"err.test\": \"Hallo Welt!\" }\r\n        // In .env: FX_LANG_DEFAULT_LANGUAGE=en\r\n        const text = lang.getText(\"err.test\", { lang: 'de' });\r\n        console.log(text);\r\n        // Hallo Welt!\r\n\r\n### SQL Queries\r\n\r\nSQL Queries are through the `db` module simplified. As in this example, you can carry out an SQL query without tanging yourself into promise nesting\r\n\r\n-   a query looks like this:\r\n\r\n        try {\r\n            const result: GamesResult = await db.query(\"SELECT * FROM games WHERE gameId = ?;\", [gameId]);\r\n        } catch (error) {\r\n            // -> error inside sql query\r\n            console.error(error);\r\n        }\r\n\r\n-   the queries can be combined as desired:\r\n\r\n          router.get(\"/games/:id\", async (req, res) => {\r\n              const gameId = req.params.id;\r\n              try {\r\n                  // execute sql query\r\n                  const games: GamesResult = await db.query(\"SELECT * FROM games WHERE gameId = ?;\", [gameId]);\r\n\r\n                  // validate\r\n                  if (!games) {\r\n                      // -> games are undefined\r\n                      throw Error; // go into catch block\r\n                  } else if (Array.isArray(games) && !games.length) {\r\n                      // -> No data founded\r\n                      throw Error; // go into catch block\r\n                  }\r\n\r\n                  // optional second, third, etc... query BEGIN\r\n                  const players: GamesResult = await db.query(\"SELECT * FROM players WHERE gameId = ?;\", [gameId]);\r\n\r\n                  // validate\r\n                  if (!players) {\r\n                      // -> games are undefined\r\n                      throw Error; // go into catch block\r\n                  } else if (Array.isArray(players) && !players.length) {\r\n                      // -> No data founded\r\n                      return res.status(401).send({\r\n                          message: lang.getText(\"err.noPlayers founded\"),\r\n                      });\r\n                  }\r\n                  // optional second, third, etc... query END\r\n\r\n                  // success\r\n                  res.status(202).send({\r\n                      message: lang.getText(\"suc.gamesFounded\"),\r\n                      data: games\r\n                  });\r\n              } catch (error) {\r\n                  // error occured\r\n                  console.error(error);\r\n                  res.status(401).send({\r\n                      message: lang.getText(\"err.insideSQLQuery\"),\r\n                  });\r\n              }\r\n          });\r\n","readmeFilename":"README.md"}