Tuesday, December 20, 2016

desktop map

windows desktop map:

------------------------------------
embed webbrowser control.

https://paulcrickard.wordpress.com/2013/04/09/leaflet-js-map-in-c/


---------------------
Gmap.net

https://greatmaps.codeplex.com/

---------------------------------------


wpf bing map control

======================================================


Friday, December 16, 2016

aqicn.org


progressive loading json

16 block X 500 cities = 8000 cities



https://wind.waqi.info/mapq/block/10/500/

https://wind.waqi.info/mapq/block/2/10/

idx = 2 x 10 n = 10
"count":8475,"idx":20,"n":10}

------------------------------------

http://www.google-analytics.com/ga.js

------------------------------

marker icon 
256 is label
15 is size

256.1.png is small icon

http://waqi.info/mapicon/256.15.png



==========================================================
Better solution is svg icon, you can change text, color, style on the fly

http://iatkin.github.io/leaflet-svgicon/

https://github.com/w8r/leaflet-labeled-circle


google map material icons is better.
https://material.io/icons/
=========================================================




-----------------------------------


3449 is site index max is 8475,

https://waqi.info/api/mapib/@00003449/info.json

will give you statistic pic in html tag










===================================================




https://github.com/scottdejonge/map-icons

svg icon on google map

Do you want to reduce redundancy for Google Maps marker images? Our Front-end Developer Robert Katzki found out how you could embed an SVG file into the Google Maps API. 
For a Google Maps based project (the web version of Boschung RWIS app) with a lot of similar markers, I was looking for a way to reduce redundancy for these marker images. The marker images look all the same, only differing in the background color. Also there is a gradient and a drop shadow included. That would be a perfect use case for a SVG symbol sprite!

The problem

Sadly the Google Maps API doesn’t allow us to use a SVG sprite as a marker image. No matter what you try – the  method or specifying an external file like markers.svg#my-icon – the marker won’t show up on the map. 

The solution

When I stumbled across Fun with SVG: Embedding in CSS, an article explaining how to embed an SVG file in CSS, I got interested. Will that work with the Maps API, too? Indeed – it does work!
new google.maps.Marker({
  position: myLatlng,
  map: map,
  icon: {
    anchor: new google.maps.Point(16, 16),
    url: 'data:image/svg+xml;utf-8, \
       \
         \
      '
  }
});
Notice that you can use line breaks, when you escape them.
Maps API doesn’t like special characters (especially), though. It doesn’t render the marker at all when that character is somewhere in the SVG. Defining a dropshadow via url (#dropshadow) does not work initially. Trick is, to use encodeURIComponent to escape all these characters.
As we have our SVG in JavaScript now, it is easy to construct it dynamically. In the next example the source SVG is in the DOM and loaded via JavaScript as text. For the background I used a placeholder that can be replaced with the actual color value. Notice the gradient and the drop shadow:
A drawback of this solution is having the paths in the DOM or in the JavaScript. Using a plain SVG symbol sprite would be my preferred solution. Still, we keep our code DRY and maintain paths only once.
Learn more about the usage of Google Maps API






For a Google Maps based project with a lot of similar markers, I was looking for a way to reduce redundancy for these marker images. The marker images look all the same, only differing in the background color. Also there is a gradient and a drop shadow included. That would be a perfect use case for a SVG symbol sprite!

The problem

Sadly the Google Maps API doesn’t allow us to use a SVG sprite as a marker image. No matter what you try – the  method or specifying an external file like markers.svg#my-icon – the marker won’t show up on the map.

The solution

When I stumbled across Fun with SVG: Embedding in CSS, an article explaining how to embed an SVG file in CSS, I got interested. Will that work with the Maps API, too? Indeed – it does work!
new google.maps.Marker({
  position: myLatlng,
  map: map,
  icon: {
    anchor: new google.maps.Point(16, 16),
    url: 'data:image/svg+xml;utf-8, \
       \
         \
      '
  }
});

==============================================================

What D3.js is Not

26 May 2014
I have played with D3.js quite a bit recently. After exploring its API and building a rather complex chart, I come to realize that I have misunderstood D3 for a long time. It’s not only me, after talking to my friends, they also have misconceptions regarding D3. So I’ve decided to write this post to clear some of the common misunderstandings.

D3 is Not a Charting Library

When you go to D3 homepage, you can see lots of amazing charts and visualizations. But D3 is not a charting library like HighchartsChart.js or Google Charts. You cannot simply pass in your dataset, specify the type of the chart you need and get a fancy chart. D3 is much lower level than that. There are charting libraries build on D3, e.g. nvd3Rickshaw

D3 is Not a Graphics Layer

D3 is not a graphics layer - in fact, most of its graphic power comes from SVG. D3 essentially provides a data friendly API for manipulating SVG (or even HTML, since they are all XML based markup language), it does not “draw” the graphics itself - the heavy-lifting of the representation is done by SVG.

D3 is Not a SVG Polyfill

Unlike Raphaël, which provides polyfill for SVG on browsers that do not support SVG. D3 manipulates SVG directly, without any abstraction layer. Your browser needs to support SVG for D3 to work properly.

D3 Does Not Support Canvas or WebGL (Almost)

Even though some of the D3 API (like d3.geo.path()) can work with both SVG and Canvas, most of its API is designed for SVG. If you are looking for Canvas Library, check out Paper.jsFabric.js and EaselJSThree.js is a decent library for WebGL.

D3 is Not Designed to Work With AngularJS

AngularJS has its own DOM manipulation API (data binding). And So does D3. To make the two work together, one of them has to take control on DOM. You can either use an AngularJS directive and pass the DOM to D3, which will do its magic, or only use the data transformation API of D3 and let AngularJS deal with DOM. However, either way, you ended up not utilizing a large part of API of either framework.

But D3 is Awesome

After playing with D3 for a while, I would define D3 as a data visualization tool, in the sense that its API has two parts: data and visualization. D3 comes with lots of handy utilities for processing data (array, time series, geo data), which is quite useful by itself. Its powerful visualization API makes it easy to bind, not only data, but also its transformation to documentation.
D3 is not very easy to learn. So when you start, it’s important to have an adequate expectation. Also, get your hands dirty early and work your way through.

Thursday, December 15, 2016

database http interface

Only support Get
http://locahost:3100/postgis/sql/db/select....encoded sql/


Get, Put, Delete
http://locahost:3100/postgis/crud/db/table/key


document store, key/value pair
http://locahost:3100/mysql/doc/db/table/key

====================================


The HTTP plugin implements multiple HTTP interfaces, for example:
• plain SQL access including meta data
• a CRUD (Create-Read-Update-Delete) interface to relational tables
• an interface for storing JSON documents in relational tables
Some of the interfaces follow Representational State Transfer (REST) ideas, some don’t.

----------------------------------------------------

There are three APIs: plain SQL over HTTP, CRUD and DOCUMENT. All three return JSON.




shell> curl ... --url "http://127.0.0.1:8080/sql/db/SELECT+1"
[
{
"meta":[
  {"type":8,"catalog":"def",
  "database":"","table":"",
  "org_table":"","column":"1","org_column":"",
  "charset":63,"length":1,
  "flags":129,"decimals":0}
],
"data":[ 
        ["1"]
],
"status":[{"server_status":2,"warning_count":0}]
}
]



The CRUD endpoint a single row from a MySQL table identified by its primary key value. The row is mapped to JSON in the most simple way. No meta data is included: a very lightweight reply.

shell> curl ...  --url "http://127.0.0.1:8080/crud/db/simple/1"
{"id":"1","col_a":"Ahoy"}

The SQL endpoint supports HTTP GET requests only. CRUD and DOCUMENT endpoints accept GET, PUT and DELETE requests. 




The DOCUMENT endpoint takes any valid JSON and stores it. The access pattern is key-document:

shell> # curl -i -X PUT --user basic_auth_user:basic_auth_passwd --url "http://127.0.0.1:8080/doc/db/another_table"
HTTP/1.1 201 Created
...
{"info": "Table created"}
shell> # curl -i -X PUT -d '{"words": ["Hello", "world"]}' --user basic_auth_user:basic_auth_passwd --url "http://127.0.0.1:8080/doc/db/another_table/key"
HTTP/1.1 200 OK
...
{"info": "Document added"}
shell> # curl -X DELETE -i --user basic_auth_user:basic_auth_passwd --url "http://127.0.0.1:8080/doc/db/another_table/"
HTTP/1.1 200 OK
...
{"info": "Table dropped"}


------------------------------------


Select all of the names in the table:
$ curl --user basic_auth_user:basic_auth_passwd --url "http://127.0.0.1:8080/sql/myhttp/SELECT+name_first,+name_last+FROM+names"
[
{
"meta":[
 {"type":253,"catalog":"def","database":"myhttp","table":"names","org_table":"names","column":"name_first","org_column":"name_first","charset":33,"length":120,"flags":0,"decimals":0},
 {"type":253,"catalog":"def","database":"myhttp","table":"names","org_table":"names","column":"name_last","org_column":"name_last","charset":33,"length":120,"flags":0,"decimals":0}
],
"data":[ 
 ["Clark","Kent"],
 ["Bruce","Wayne"],
 ["Hal","Jordan"],
 ["Barry","Allen"],
 ["Diana","Prince"],
 ["Arthur","Curry"],
 ["Oliver","Queen"],
 ["Ray","Palmer"],
 ["Carter","Hall"]
],
"status":[{"server_status":34,"warning_count":0}]
}
]


Selecting a single name:
$ curl --user basic_auth_user:basic_auth_passwd --url "http://127.0.0.1:8080/sql/myhttp/SELECT+name_first,+name_last+FROM+names+where+name_first+=+'Clark'"
[
{
"meta":[
 {"type":253,"catalog":"def","database":"myhttp","table":"names","org_table":"names","column":"name_first","org_column":"name_first","charset":33,"length":120,"flags":0,"decimals":0},
 {"type":253,"catalog":"def","database":"myhttp","table":"names","org_table":"names","column":"name_last","org_column":"name_last","charset":33,"length":120,"flags":0,"decimals":0}
],
"data":[ 
 ["Clark","Kent"]
],
"status":[{"server_status":34,"warning_count":0}]
}
]
Deleting a row:
$ curl --user basic_auth_user:basic_auth_passwd --url "http://127.0.0.1:8080/sql/myhttp/delete+from+names+where+name_first+=+'Hal'"
{"server_status":34,"warning_count":0,"affected_rows":1,"last_insert_id":0}
Inserting a row:
$ curl --user basic_auth_user:basic_auth_passwd --url "http://127.0.0.1:8080/sql/myhttp/INSERT+INTO+names+(name_first,+name_last)+VALUES+('Hal','Jordan');"
{"server_status":2,"warning_count":0,"affected_rows":1,"last_insert_id":1018}






































































Monday, December 12, 2016

postgis query

SELECT json_build_object(
    'type', 'FeatureCollection',
 
    'features', json_agg(
        json_build_object(
            'type',       'Feature',
            'id',         gid,
            'geometry',   ST_AsGeoJSON(ST_ForceRHR(st_transform(geom,4326)))::json,
            'properties', jsonb_set(row_to_json(city_parks)::jsonb,'{geom}','0',false)
        )
    )
)
FROM city_parks
WHERE ST_Intersects(city_parks.geom,st_transform(ST_GeographyFromText('POLYGON((-117.963690 33.634180,-117.854780 33.634180,-117.854780 33.702970,-117.963690 33.702970,-117.963690 33.634180))')::geometry,2230));




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


SELECT json_build_object(
    'type', 'FeatureCollection',
 
    'features', json_agg(
        json_build_object(
            'type',       'Feature',
            'id',         gid,
            'geometry',   ST_AsGeoJSON(ST_ForceRHR(st_transform(geom,4326)))::json,
            'properties', jsonb_set(row_to_json(city_parks)::jsonb,'{geom}','0',false)
        )
    )
)
FROM city_parks
WHERE ST_Intersects(st_transform(city_parcels.geom,4326), ST_GeographyFromText('SRID=4326;POLYGON((-117.935228 33.656995,-117.935228 33.640705,-117.913642 33.640205,-117.914071 33.657138,-117.935228 33.656995))'));






------------------------------------------------------------------------

find all the city parks, which within or touch the rectangular bound(polygon(lng,lat)..)
above sql will output geojson, but not yet, assume'result" is whatever postgresql output, the real valid geojson is in result.rows[0].json_build_object
for example you use node.js the response send should be: res.send(result.rows[0].json_build_object);

more explain about the sql:
::json means cast to json type ::jsonb means cast to jsonb type( json binary type)
jsonb_set() because the row_to_json() will convert all column include geom to properties list, which you do not want geom column, you want to remove it, but so far not remove method provided by postgresql json operation method, so I use jsonb_set to reset geom to '0', here you can't use null, otherwise, all properties list will be null.
city_parks is the table name in postgresql, geom is the geometry column name.
geojson's SRID is always 4326
city_parks 's SRID is 2230
ST_ForceRHR() is used because geojson polygon follow right hand rule, this will fore polgyon vertice follow right hand rule
when you use st_intersects(a, b), a and b both must be geometry or both must be geography type.
  st_interesects(geometry, geography)  // invalid
city parks geom is geometry type with SRID=2230,
Bounding box polygon((lng,lat),(lng,lat)...) is geography type with SRID=4326,
st_transform() was used to either convert from SRID(2230) to SRID(4326) or like wise

row_to_json() will convert all column in this row to json

select row_to_json(city_parks) from city_parks;

{"id":6013,"column_name_1":"value1","column_name_2":"value2",... etc}


-------------------------------------------------------------------------------------------------------
select name_alf, st_asgeojson(st_transform(geom,4326)) as latlng from city_parks



***************************
st_intersects( st_transform(geom, 4326):geography,    bounding box(lng,lat)
********************************

select name_alf, st_asgeojson(st_transform(geom,4326)) as latlng from city_parks  WHERE ST_Intersects(st_transform(city_parks.geom,4326)::geography, ST_GeographyFromText('SRID=4326;POLYGON((-117.963690 33.634180,-117.854780 33.634180,-117.854780 33.702970,-117.963690 33.702970,-117.963690 33.634180))'));

select name_alf, st_asgeojson(st_transform(geom,4326)) as latlng from city_parks  WHERE ST_Intersects(st_transform(city_parks.geom,4326), ST_GeographyFromText('SRID=4326;POLYGON((-117.963690 33.634180,-117.854780 33.634180,-117.854780 33.702970,-117.963690 33.702970,-117.963690 33.634180))'));

********************
or, you can st_intersect(geom,  st_transform( bounding box(lng,lat):geometry , 2230))
*************************************

select name_alf, st_asgeojson(st_transform(geom,4326)) as latlng from city_parks  WHERE ST_Intersects(city_parks.geom,st_transform(ST_GeographyFromText('POLYGON((-117.963690 33.634180,-117.854780 33.634180,-117.854780 33.702970,-117.963690 33.702970,-117.963690 33.634180))')::geometry,2230));



both work, st_intersects(A, B)

A, B both be geometry,  or Both be geography.

A,B SRID must be same, if different, must use st_transform() to make both SRID same. 



-----------------------------------------------------------------------

::geography   will cast geometry to geography
::geometry will cast geography to geometry

geojson polygon right hand rule does not matter, you can clock wise or anti-clock wise.

geom column in city_park table are geometry with special SRID, if you want to use 

ST_intersects, you must st_transform(geom, 4326)

Because the lat long bounding box you get SRID=4236, 

so you have to transform geom to 4326 before run st_intersects.  

==================================================






















SELECT Find_SRID('public','city_parks','geom')


select st_asgeojson(st_transform(st_setsrid(geom,2230),4326)) from city_parks;

select st_asgeojson(st_transform(geom,4326)) from city_parks;



+++++++++++++++++++++++++++++++++++
samples:


=================================
{
  "type": "Polygon",
  "coordinates": [
    [
   
 [-117.963690, 33.634180],[-117.854780, 33.634180],[-117.854780, 33.702970],[-117.963690, 33.702970],[-117.963690, 33.634180]
    ]
  ]
}

small box of city

-117.935228 33.656995,-117.935228 33.640705,-117.913642 33.640205,-117.914071 33.657138,-117.935228 33.656995

====================================

select st_asgeojson(st_transform(st_setsrid(geom,2230),4326)) from city_parks;

select st_asgeojson(st_transform(geom,4326)) from city_parks;


SELECT Find_SRID('public','city_parks','geom')

select name_alf, st_asgeojson(st_transform(geom,4326)) as latlng from city_parks

select name_alf, st_asgeojson(st_transform(geom,4326)) as latlng from city_parks  WHERE ST_Intersects(st_transform(city_parks.geom,4326)::geography, ST_GeographyFromText('SRID=4326;POLYGON((-117.963690 33.634180,-117.854780 33.634180,-117.854780 33.702970,-117.963690 33.702970,-117.963690 33.634180))'));

select name_alf, st_asgeojson(st_transform(geom,4326)) as latlng from city_parks  WHERE ST_Intersects(st_transform(city_parks.geom,4326), ST_GeographyFromText('SRID=4326;POLYGON((-117.963690 33.634180,-117.854780 33.634180,-117.854780 33.702970,-117.963690 33.702970,-117.963690 33.634180))'));

select name_alf, st_asgeojson(st_transform(geom,4326)) as latlng from city_parks  WHERE ST_Within(st_transform(city_parks.geom,4326)::geography, ST_GeographyFromText('SRID=4326;POLYGON((-117.963690 33.634180,-117.854780 33.634180,-117.854780 33.702970,-117.963690 33.702970,-117.963690 33.634180))'));



select address, st_asgeojson(st_transform(geom,4326)) as latlng from city_parcels  WHERE ST_Intersects(st_transform(city_parcels.geom,4326), ST_GeographyFromText('SRID=4326;POLYGON((-117.963690 33.634180,-117.854780 33.634180,-117.854780 33.702970,-117.963690 33.702970,-117.963690 33.634180))'));
select address, st_asgeojson(st_transform(geom,4326)) as latlng from city_parcels  WHERE ST_Intersects(st_transform(city_parcels.geom,4326), ST_GeographyFromText('SRID=4326;POLYGON((-117.935228 33.656995,-117.935228 33.640705,-117.913642 33.640205,-117.914071 33.657138,-117.935228 33.656995))'));


select count(*) as total from city_parcels  WHERE ST_Intersects(st_transform(city_parcels.geom,4326), ST_GeographyFromText('SRID=4326;POLYGON((-117.963690 33.634180,-117.854780 33.634180,-117.854780 33.702970,-117.963690 33.702970,-117.963690 33.634180))'));
2 sec
select count(*) as total from city_parcels  WHERE ST_Intersects(st_transform(city_parcels.geom,4326), ST_GeographyFromText('SRID=4326;POLYGON((-117.935228 33.656995,-117.935228 33.640705,-117.913642 33.640205,-117.914071 33.657138,-117.935228 33.656995))'));
1 sec

.......................................

select name_alf, st_asgeojson(st_transform(geom,4326)) as latlng from city_parks  WHERE ST_Intersects(city_parks.geom,st_transform(ST_GeographyFromText('POLYGON((-117.963690 33.634180,-117.854780 33.634180,-117.854780 33.702970,-117.963690 33.702970,-117.963690 33.634180))')::geometry,2230));


ST_ForceRHR()
select name_alf, st_asgeojson(st_transform(ST_ForceRHR(geom),4326)) as latlng from city_parks  WHERE ST_Intersects(city_parks.geom,st_transform(ST_GeographyFromText('POLYGON((-117.963690 33.634180,-117.854780 33.634180,-117.854780 33.702970,-117.963690 33.702970,-117.963690 33.634180))')::geometry,2230));


select name_alf, st_asgeojson(ST_ForceRHR(st_transform(geom,4326))) as latlng from city_parks  WHERE ST_Intersects(city_parks.geom,st_transform(ST_GeographyFromText('POLYGON((-117.963690 33.634180,-117.854780 33.634180,-117.854780 33.702970,-117.963690 33.702970,-117.963690 33.634180))')::geometry,2230));




select address, st_asgeojson(st_transform(geom,4326)) as latlng from city_parcels  WHERE ST_Intersects(city_parcels.geom,st_transform(ST_GeographyFromText('POLYGON((-117.963690 33.634180,-117.854780 33.634180,-117.854780 33.702970,-117.963690 33.702970,-117.963690 33.634180))')::geometry,2230));
[27 sec]
select address, st_asgeojson(st_transform(geom,4326)) as latlng from city_parcels  WHERE ST_Intersects(city_parcels.geom,st_transform(ST_GeographyFromText('POLYGON((-117.935228 33.656995,-117.935228 33.640705,-117.913642 33.640205,-117.914071 33.657138,-117.935228 33.656995))')::geometry,2230));
[3 sec]

select count(*) as total from city_parcels  WHERE ST_Intersects(city_parcels.geom,st_transform(ST_GeographyFromText('POLYGON((-117.963690 33.634180,-117.854780 33.634180,-117.854780 33.702970,-117.963690 33.702970,-117.963690 33.634180))')::geometry,2230));
224 ms
select count(*) as total from city_parcels  WHERE ST_Intersects(city_parcels.geom,st_transform(ST_GeographyFromText('POLYGON((-117.935228 33.656995,-117.935228 33.640705,-117.913642 33.640205,-117.914071 33.657138,-117.935228 33.656995))')::geometry,2230));
124 ms

..........................................


geojson polygon must force right hand rule

ST_ForceRHR()

select name_alf, st_asgeojson(st_transform(geom,4326)) as latlng from city_parks

select name_alf, st_asgeojson(ST_ForceRHR(st_transform(geom,4326))) as latlng from city_parks


select name_alf, st_asgeojson(geom) as latlng from city_parks

select name_alf, st_asgeojson(ST_ForceRHR(geom)) as latlng from city_parks


---------------------------------


SELECT json_build_object(
    'type', 'FeatureCollection',
 
    'features', json_agg(
        json_build_object(
            'type',       'Feature',
            'id',         gid,
            'geometry',   ST_AsGeoJSON(ST_ForceRHR(st_transform(geom,4326)))::json,
            'properties', json_build_object(
                'name_alf', name_alf
            )
        )
    )
)
FROM city_parks
WHERE ST_Intersects(city_parks.geom,st_transform(ST_GeographyFromText('POLYGON((-117.963690 33.634180,-117.854780 33.634180,-117.854780 33.702970,-117.963690 33.702970,-117.963690 33.634180))')::geometry,2230));


--------------------------------------------------------------------

SELECT json_build_object(
    'type', 'FeatureCollection',
 
    'features', json_agg(
        json_build_object(
            'type',       'Feature',
            'id',         gid,
            'geometry',   ST_AsGeoJSON(ST_ForceRHR(st_transform(geom,4326)))::json,
            'properties', row_to_json(city_parks)
        )
    )
)
FROM city_parks
WHERE ST_Intersects(city_parks.geom,st_transform(ST_GeographyFromText('POLYGON((-117.963690 33.634180,-117.854780 33.634180,-117.854780 33.702970,-117.963690 33.702970,-117.963690 33.634180))')::geometry,2230));

----------------------------------------------------------------------


SELECT json_build_object(
    'type', 'FeatureCollection',
 
    'features', json_agg(
        json_build_object(
            'type',       'Feature',
            'id',         gid,
            'geometry',   ST_AsGeoJSON(ST_ForceRHR(st_transform(geom,4326)))::json,
            'properties', jsonb_set(row_to_json(city_parks)::jsonb,'{geom}','0',false)
        )
    )
)
FROM city_parks
WHERE ST_Intersects(city_parks.geom,st_transform(ST_GeographyFromText('POLYGON((-117.963690 33.634180,-117.854780 33.634180,-117.854780 33.702970,-117.963690 33.702970,-117.963690 33.634180))')::geometry,2230));



======================


SELECT json_build_object(
    'type', 'FeatureCollection',
 
    'features', json_agg(
        json_build_object(
            'type',       'Feature',
            'id',         gid,
            'geometry',   ST_AsGeoJSON(ST_ForceRHR(st_transform(geom,4326)))::json,
            'properties', jsonb_set(row_to_json(city_parks)::jsonb,'{geom}','0',false)
        )
    )
)
FROM city_parks
WHERE ST_Intersects(st_transform(city_parcels.geom,4326), ST_GeographyFromText('SRID=4326;POLYGON((-117.935228 33.656995,-117.935228 33.640705,-117.913642 33.640205,-117.914071 33.657138,-117.935228 33.656995))'));




SELECT jsonb_set('{"bar":"baz","balance":1,"active":false}','{bar}','6',false);
SELECT jsonb_set('{"f1":1,"f2":null}', '{f1}','6', false)

=====================================================

select row_to_json(city_parks) from city_parks



SELECT UpdateGeometrySRID('city_parks','geom',2230);


Friday, December 9, 2016

postgis_express


start express server:

cd your app folder

npm install                -------- this is install dependency

npm start

localhost:3000 should work.


=================================

$ npm install -g express --save
-g install globally
means, express lib will be installed at
C:\Users\engcid299\AppData\Roaming\npm

You must add above path to Either user environment variable path or system environment variable path.

otherwise, get error
'express' is not recognized as an internal or external command,

Mac:
 same, add to path
export PATH=/usr/local/share/npm/bin:$PATH


================================

visual studio code:

add, C:\Program Files (x86)\Microsoft VS Code
to path  (user environment variable)


Mac:
same add to path

After installation, launch VS Code. Now open the Command Palette (⇧⌘P) and type shell command to find the Shell Command: Install 'code' command in PATH command.
enter image description here




open project
cd your app foler
code .

ctrl + `  open integrate terminal



======================================

Press Ctrl + C twice to exit nodejs.


================================================

Express application generator


$ npm install express-generator -g

create myapp(your project name)
$ express --view=jade myapp

install dependence
$ cd myapp
$ npm install
> set DEBUG=myapp:* & npm start

Then load http://localhost:3000/ in your browser to access the app.



==============================
netbean create new node.js project

cd to that directory,

--save will add express dependancy to package.json

npm install restify --save
=================================







======================
netbean create new node.js project

cd to that directory,

--save will add express dependancy to package.json

$ npm install express --save