forked from denoland/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnpm.ts
29 lines (25 loc) · 971 Bytes
/
npm.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
* @title Import modules from npm
* @difficulty beginner
* @tags cli
* @run --allow-net --allow-read --allow-env <url>
* @resource {https://docs.deno.com/runtime/manual/node} Node.js / npm support in Deno
* @resource {https://docs.deno.com/runtime/manual/node/npm_specifiers} npm: specifiers
* @resource {https://www.npmjs.com/package/express} express module on npm
* @group Basics
*
* Use JavaScript modules from npm in your Deno programs with the "npm:"
* specifier in your imports.
*/
// Import the express module from npm using an npm: prefix, and appending a
// version number. Dependencies from npm can be configured in an import map
// also.
import express from "npm:[email protected]";
// Create an express server
const app = express();
// Configure a route that will process HTTP GET requests
app.get("/", (_req, res) => {
res.send("Welcome to the Dinosaur API!");
});
// Start an HTTP server using the configured Express app
app.listen(3000);