This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module app | |
| go 1.17 | |
| require ( | |
| github.com/go-playground/webhooks/v6 v6.0.0-rc.1 | |
| github.com/gofiber/fiber/v2 v2.25.0 | |
| github.com/valyala/fasthttp v1.32.0 | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| workspace( | |
| name = "my_workspace", | |
| # Bazel should manage the "node_modules" directory | |
| managed_directories = {"@npm": ["node_modules"]}, | |
| ) | |
| // ... | |
| load("@build_bazel_rules_nodejs//:index.bzl", "npm_install") | |
| npm_install( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") | |
| nodejs_binary( | |
| name = "app", | |
| entry_point = ":index.js", | |
| data = [ | |
| # Define needed NPM package dependency | |
| "@npm//express" | |
| ] | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express') | |
| const app = express() | |
| const port = 3000 | |
| app.get('/', (req, res) => { | |
| console.log('Received request'); | |
| res.send('Hello World!') | |
| }) | |
| app.listen(port, () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") | |
| nodejs_binary( | |
| name = "app", | |
| entry_point = ":index.js" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") | |
| nodejs_binary( | |
| name = "app_glob", | |
| entry_point = ":index.js", | |
| ## **/*.js -> matches every '.js' file in every subdirectory of this package | |
| data = glob(["**/*.js"]) | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") | |
| nodejs_binary( | |
| name = "app", | |
| entry_point = ":index.js", | |
| ## Adding the "subfolder/second.js" file to the "binary" | |
| data = ["subfolder/second.js"] | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Import 'second' module | |
| const myModule = require('./subfolder/second'); | |
| // Expecting 'Hello Bazel' as output | |
| console.log(myModule.myFunc('Bazel')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = { | |
| // Adds 'Hello' in front of the input string and returns it | |
| myFunc: (input) => { | |
| return `Hello ${input}` | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bazel-bin | |
| bazel-medium-bazel-nodejs-getting-started | |
| bazel-out | |
| bazel-testlogs | |
| .idea | |
| node_modules |