https://github.com/gjeanmart/nodejs
https://github.com/gjeanmart/nodejs
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/gjeanmart/nodejs
- Owner: gjeanmart
- Created: 2016-12-07T22:14:13.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-07T00:46:22.000Z (over 8 years ago)
- Last Synced: 2025-02-14T21:28:25.535Z (4 months ago)
- Language: JavaScript
- Size: 1000 Bytes
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# nodejs
## Prerequisite
Install NodeJS and NPM## Initialize a project
```
$ mkdir app$ cd app
$ npm init .
$ npm install --save express
```## First app
### REST API
1. Create a file *server.js*```
var express = require('express')
var app = express()
app.get('/api', function(req, res) {
res.json({api: "This is your api."})
})
app.listen(3000)
```### Run the app
```
$ cd app$ nodejs server.js
```