0.0.16 • Published 5 years ago

noktjs v0.0.16

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

NoktJS >WORK IN PROGRESS<

A tool for REST API in nodejs and postgresql

How it works ?

Create project

> npx noktjs create [project name]

Create application

In you project directory:

> npx noktjs createApp [appName]

Create Model

In the models directory in application.

models/video.js

const {Model} = require('noktjs');

const VideoTemplate = {
  nameModel:'Video',
  title: Model.charfield(50),
  url: Model.charfield(100),
  description: Model.text(),
  views: Model.integer()
};
module.exports.VideoTemplate = VideoTemplate;

Create Database model

models/index.js

create = async ()=>{
/* Create model */
  await createModel(VideoTemplate);
}

Create REST handler and routes from Template

handlers/index.js

create = async ()=>{
/* Create model */
  await createHandler(VideoTemplate).then(async ()=>{
    await createRoutes(VideoTemplate, appName);
  });
}

Configure Postgresql DB

*.env

PGUSER=dbuser
PGHOST=database.server.com
PGPASSWORD=secretpassword
PGDATABASE=mydb
PGPORT=3211
ACCESS_TOKEN_SECRET=GENERATETOKEN

Build Project

npm run build

create DB

npm run create-db

Start Project with Nodemon

> npm start

What it does ?

It creates a complete REST API. Where all files are readable and editable for possible optimizations. It also synchronizes the project files by directly editing the files concerned

0.0.16

5 years ago

0.0.15

5 years ago

0.0.13

5 years ago

0.0.14

5 years ago

0.0.12

5 years ago

0.0.10

5 years ago

0.0.11

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.1

5 years ago