diff options
| author | Mhykol <mchaeldonald62@pm.me> | 2024-05-06 06:56:34 -0400 |
|---|---|---|
| committer | Mhykol <mchaeldonald62@pm.me> | 2024-05-06 06:56:34 -0400 |
| commit | fc806cd257af1f105e58c9462006397f6b431c4f (patch) | |
| tree | 6a407cbf0fa16d79e1a74f8c219640b668432dab | |
| parent | 9024899fed787ced80a5289804c9941ddcaa3252 (diff) | |
Added README
| -rw-r--r-- | README.md | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..c74d4ad --- /dev/null +++ b/README.md @@ -0,0 +1,108 @@ +# Installation +**Arch** +Install dependencies +```bash +pacman -S npm nodejs +``` +**Debian/Ubuntu** +```bash +apt install npm nodejs +``` + +Download +```bash +git clone https://git.fatalmatrix.xyz/cosmic.git +``` + +Install node modules +```bash +npm i +``` + +Install `npm-check-updates` Optional +```bash +npm install -g npm-check-updates +ncu -u +npm i +``` + +Run `ncu -u` to update modules + +# Usage +**Create `.env` file** +```.env +baseUrl = "http://127.0.0.1:3000/" +emailUsername = "email@email.com" +emailPassword = "password" +NODE_ENV = "dev" +MYSQL_HOST = "127.0.0.1" +MYSQL_USER = "root" +MYSQL_PASSWORD = "Password" +``` +On `NODE_ENV` change `dev` to `prod` + +**Pages** +Add pages in the `scripts` folder +```js +class Shop() { + constructor() {} + + // GET `/shop` + Main() { + const data = { + start: ``, + body: ``, + end: `` + } + return data.start + data.body + data.end + } + + // GET `/shop/product` or POST `/shop/product` and get output from `value` + Product(value) { + const data = { + start: ``, + body: ``, + end: `` + } + return data.start + data.body + data.end + } + + // Required + module.exports = () => {return new Shop()} +} +``` + +**Layouts** +Layouts are located in `views/layouts` + +**Blog** +Blogs must be in markdown format in the `blog` folder + +To get the title, date and short description to display you must use the format below +```markdown +# Title +Date: 1/1/1999 +--- +Short description +--- +Content goes here +``` +Place markdown file in `blog` folder + +If `blog` folder does not exist +```bash +mkdir blog +``` + +To get blog output +```js +const blog = require('../source/blog') + +blog().ReadBlogs().then(output => { + output.forEach((value, key) => { + console.log(`key: ${key}`) + console.log(value) + }) +}) +``` + |
