Create express based APIs to upload and download files to and from MongoDB GridFS.
Posts for: #NodeJS
Configure ES Lint with Airbnb rules for a Node.js Application
Install ES Lint modules
npm install --save-dev eslint-plugin-import eslint
Install Airbnb config
Use the base version for Node.js applications. They also publish a version for React applications as eslint-config-airbnb
.
Deploy functions on Spotinst using Serverless Framework
Spotinst is one of the providers which support deploying serverless functions or FaaS (Function as a Service). Serverless Framework is an NPM module which makes building serverless applications easy and open.
NPM Module - Complex JSON to Query String
@abskmj/query
It is an NPM module that converts complex JSON with arrays and nested objects into URL parameters or query string. It can also parse such query string back to JSON.
Developing an Angular project on Cloud9 IDE
Update NodeJS version
- All of the blank VMs on cloud9 have nvm pre installed.
- List all the available versions from the official site.
nvm ls-remote
- Choose to install the latest version
nvm install v10.6.0
- Choose to use the latest version
nvm use v10.6.0
- Check the version in use
node --version
Angular
- Install latest Angular CLI package
npm install -g @angular/cli
- Create a new project named
my-project
(you can use any name you need)
ng new my-project
cd my-project
- Change
start
script inpackage.json
{
...
"scripts": {
...
"start": "ng serve --host $IP --port $PORT --public-host $C9_HOSTNAME",
...
}
...
}
- On IDE menu, click on
Preview > Preview Running Application
to get the preview URL.
Downside
Everything works perfectly expect that the live reload, sometimes, is slower than usual.
Track API usage with Google Analytics
Google analytics is a popular tool to track your website usage. Usage of server APIs can also be tracked with this tool. Measurement Protocol APIs can be used to post the usage data to Google Analytics.