-
Notifications
You must be signed in to change notification settings - Fork 1
node js es6 import #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
{
"name": "node-express4-restful-api",
"version": "4.15.2",
"description": "RESTful-API-Node-Express4, xgqfrms",
"main": "index.js",
"scripts": {
"start": "node server.js",
"run": "node server.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/xgqfrms/node-express4-restful-api.git"
},
"keywords": [
"RESTful",
"API",
"Node",
"Express4",
"MongoDB",
"Mongoose"
],
"author": "xgqfrms, webgeeker",
"license": "MIT",
"bugs": {
"url": "https://github.com/xgqfrms/node-express4-restful-api/issues"
},
"homepage": "https://github.com/xgqfrms/node-express4-restful-api#readme",
"dependencies": {
"body-parser": "^1.17.1",
"express": "^4.15.2",
"mongoose": "^4.9.8",
"morgan": "^1.8.1"
}
}
|
// configure our application and create routes
const express = require('express'),
const app = express();
const bodyParser = require('body-parser');
const port = process.env.PORT || 8080;
app.use(
bodyParser.urlencoded(
{
extended: true
}
)
);
app.use(
bodyParser.json()
);
let router = express.Router();
// http://localhost:8080/api
router.get('/', function(req, res) {
res.json({ message: 'hooray! welcome to our api!' });
});
router.get('/:id', function(req, res) {
res.json({ message: 'hooray! welcome to our api id!' });
});
app.use('/api', router);
app.listen(port);
console.log('Magic happens on port ' + port);
|
module.exports & exports
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
node js es6 import
https://stackoverflow.com/questions/37132031/nodejs-plans-to-support-import-export-es6-es2015-modules
https://medium.com/the-node-js-collection/an-update-on-es6-modules-in-node-js-42c958b890c
https://segmentfault.com/a/1190000006864073
nodejs/help#53
https://github.com/nodejs/node/wiki/ES6-Module-Detection-in-Node
http://stackoverflow.com/questions/37132031/nodejs-plans-to-support-import-export-es6-es2015-modules
http://stackoverflow.com/questions/31354559/using-node-js-require-vs-es6-import-export
https://nodejs.org/en/docs/es6/
https://codequs.com/p/Byvv408t/using-es6-import-export-in-node-js-babel-js/
The text was updated successfully, but these errors were encountered: