apify-node
v1.3.10
Published
Rest API for express framework
Downloads
59
Readme
**NOTE:**Not working on windows yet
About: Apify is a simple UI tool for building a node.js backend APIs. It generates routes, fast, so you cand focus on App logic. Using Apify you will have a centralized place of all your API routes and documented using the comments function.
Initialize:
- cmd: npm install -g apify-node will install apify-node
- cmd: apify init will initialize a new Project, based on express-generator npm module
- cmd: apify serve will create a http server on port 3000
- cmd: apify ui will open the UI based Apify application
USAGE of Apify UI
Add new routes
Add child routes
Enable database link This will setup all the configurations needed for a mysql database connection in your project.
Generate routes with a database link After enabling the database link, you are able to generate new routes with db functions linked. After generating a new route with a database link, all you need to do, to get the response to the frontend, is to write your query.
Enable authentication and add roles
Enabling the authentication will create all the code your project need in order to authenticate users, and 2 new child routes with database link for users route:
Add routes with authentication required After enabling authentication, you can now create child routes with authentication required.
Accessing this route will require admin or user privileges. The user object needs to have a "role" property in the database. For example you users table will have the following fields in the mysql table:
username : John password : testpwdencrypted role : admin
At this point the generated application will return a hardcoded user. It is you job to write the code that will query your database and decide if the user is allowed to authenticate
*Apify is using express-generator in order to generate the node.js project and Electron framework for the Apify UI support.