Microback
An API microservice server using koa. It can be used to build both REST API and Websocket server.
microback-starter
For starter application please look at:Documentation
To start from scratch
yarn add microback
- add .env file
- add following key
PORT=2020 MONGODB=mongodb://localhost:27017/yourdb SECUREKEY=my-key
- add
app
folder - add
api
insideapp
folder - create your first REST API controller which in this case
UserRest
/*** import all necessary function from microback* RestGen is responsible to create automatic route* route is decorator funciton* auth is used for hashing some string e.g. password*//*** construction is used to pass the name* of the endpoint which will be automatically pluralized* for certain endpoints which can be checked from* http://yourhost/routes* second argument is for model object if you need to create* automatic RESt routes for a certain model and this is optional*/{super'user' User}/*** creating route with method and path* using decorator pattern and write* function using async await*/@async {trylet body = ctxrequestbodybodypassword = authconst token = await authctxbody = success: true tokencatch errorctxbody = success: false error}