Skip to content

Commit

Permalink
fix: updating node-example-npm & node-example-yarn to use esm and cha…
Browse files Browse the repository at this point in the history
…i to v5
  • Loading branch information
pattishin committed Jan 19, 2024
1 parent b139e0f commit bb58ffd
Show file tree
Hide file tree
Showing 12 changed files with 3,698 additions and 72 deletions.
1 change: 1 addition & 0 deletions node-example-npm/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# node-example-npm

Code examples used in Building Node.js applications using Cloud Build
https://cloud.google.com/build/docs/building/build-nodejs
26 changes: 13 additions & 13 deletions node-example-npm/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@

# [START cloudbuild_npm_node]
steps:
# Install dependencies
- name: node
entrypoint: npm
args: ['install']
# Run tests
- name: node
entrypoint: npm
args: ['test']
# Run custom commands
- name: node
entrypoint: npm
args: ['run', 'build']
# [END cloudbuild_npm_node]
# Install dependencies
- name: node
entrypoint: npm
args: ["install"]
# Run tests
- name: node
entrypoint: npm
args: ["test"]
# Run custom commands
- name: node
entrypoint: npm
args: ["run", "build"]
# [END cloudbuild_npm_node]
14 changes: 7 additions & 7 deletions node-example-npm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
* limitations under the License.
*/

const express = require('express');
import express from "express";

const app = express();

app.get('/', (req, res) => {
res.send('Hello World!');
});
app.get("/", (req, res) => {
res.send("Hello World!");
});

const port = 3000;
const server = app.listen(port, () => {
console.log('listening on port %s.\n', server.address().port);
});
console.log("listening on port %s.\n", server.address().port);
});

module.exports = app;
export default app;
Loading

0 comments on commit bb58ffd

Please sign in to comment.