diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 65 |
1 files changed, 46 insertions, 19 deletions
@@ -1,35 +1,58 @@ +# Project Name +Cosmic is a framework build on top of express. + # Installation -**Arch** -Install dependencies +## Arch ```bash pacman -S npm nodejs -``` -**Debian/Ubuntu** -```bash -apt install npm nodejs +git clone https://git.fatalmatrix.xyz/cosmic.git ``` -Download +## Debian/Ubuntu ```bash +apt install npm nodejs git clone https://git.fatalmatrix.xyz/cosmic.git ``` +## Configure `nodejs` Install node modules ```bash +cd cosmic +npm i -g npm@latest # Must be run as root npm i ``` -Install `npm-check-updates` Optional +On Debian/Ubuntu you may get an error due to the nodejs version. + +To fix this install `nvm` +```bash +# Install nvm +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash + +# Load nvm +export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + +# Install latest node version +nvm i node +``` + +Install `npm-check-updates` ```bash -npm install -g npm-check-updates +npm install -g npm-check-updates # Must be root ncu -u npm i ``` +Install `pm2` +```bash +npm i -g pm2 # Must be root +``` + Run `ncu -u` to update modules # Usage -**Create `.env` file** +## Create `.env` file ```.env baseUrl = "http://127.0.0.1:3000/" emailUsername = "email@email.com" @@ -41,8 +64,8 @@ MYSQL_PASSWORD = "Password" ``` On `NODE_ENV` change `dev` to `prod` -**Pages** -Add pages in the `scripts` folder +## Create Pages +To create a page write a `class` then add to the `scripts` folder. ```js class Shop() { constructor() {} @@ -67,16 +90,16 @@ class Shop() { return data.start + data.body + data.end } - // Required + // This is required module.exports = () => {return new Shop()} } ``` -**Layouts** -Layouts are located in `views/layouts` +## Layouts +Layouts are located in `views/layouts` if you would like to modify them. -**Blog** -Blogs must be in markdown format in the `blog` folder +## Blog +Blogs must be a markdown file placed in the `blog` folder To get the title, date and short description to display you must use the format below ```markdown @@ -84,17 +107,17 @@ To get the title, date and short description to display you must use the format 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 +To get the output for blogs you must lost the `blog.js` module ```js const blog = require('../source/blog') @@ -106,3 +129,7 @@ blog().ReadBlogs().then(output => { }) ``` +## Run +```bash +npm run prod +``` |
