0.0.16 • Published 4 years ago

noktjs v0.0.16

Weekly downloads
1
License
ISC
Repository
-
Last release
4 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

4 years ago

0.0.15

4 years ago

0.0.13

4 years ago

0.0.14

4 years ago

0.0.12

4 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.1

4 years ago