{
"name": "reallybigone",
"version": "0.0.1",
"devDependencies": {
"gulp": "3.9.0",
"gulp-autoprefixer": "2.3.1",
"gulp-sourcemaps": "1.5.2",
"serve": "1.4.0"
"node-sass": "3.4.2"
},
"scripts": {
"start": "serve -p 3000 ."
}
}
ā² ~/my-proj $
š« now allows you to take your JavaScript (Node.js) powered websites, applications and services to the cloud with ease, speed and reliability.
In practical terms, any directory that contains a package.json
file can be transported to the cloud with one command: now
.
Every time you deploy a project, š« now gives you a unique URL to it (even before build processes are complete!). These URLs look like this: my-app-sknncqwaoc.now.sh
.
When it's time to take your deployment to production, you simply pick an appropriate alias.
You can think of š« now as a CDN for dynamic code (microservices and backends).
To get started using now, install it from npm:
$ npm install -g now
When the installation is finished, it'll ask for your email to identify you.
Click the email you receive, and you'll be automatically logged-in.
If you need to change your login or re-authenticate, run
$ now --login
On a terminal, run:
$ mkdir /my-project
$ cd /my-project
It's important that your project has a package.json
file.
Within it, you have to define a start
script:
{
"name": "my-project",
"version": "0.0.1",
"dependencies": {
"express": "4.13.4"
},
"scripts": {
"start": "node index.js"
}
}
Your index.js for this example could look as follows:
const app = require('express')();
app.get('/', (req, res) => {
res.send('Welcome');
});
app.listen();
NOTE: npm start
has to listen on a port. It can be any port!
To deploy with now
, run:
$ now
You'll get a link (copied to your clipboard by default) that you can share
immediately with your peers, even before upload and startup completes.
š« now only requires Node.JS to be installed in your computer.
git
or source controlEvery time your run now
, you get a fresh URL that represents the current state of your application.
As soon as you type now
, we give you a URL that you can go to or share with co-workers and collaborators.
This URL will show the progress of your deployment. You might see files uploading, and then we show you the progress of the commands executed to deploy your program.
As a matter of fact, now
is so fast that you might not even get to see this in many cases!
š« now exposes servers that speak the HTTP protocol. We don't impose any new propritary Cloud APIs. You can run your apps -with our without š« now- with OSS software.
In addition:
If you add /_src
to any now URL (example), you'll see the code behind it. You and your team will be able to quickly understand what's behind your production systems.
{
"name": "reallybigone",
"version": "0.0.1",
"devDependencies": {
"gulp": "3.9.0",
"gulp-autoprefixer": "2.3.1",
"gulp-sourcemaps": "1.5.2",
"serve": "1.4.0"
"node-sass": "3.4.2"
},
"scripts": {
"start": "serve -p 3000 ."
}
}
What's more, every character and line of code is hyperlinkable. This makes collaborative issue triaging and debugging a breeze!
Perfect for open-source demos, classrooms, tutorials & testing.
The /_src URL is always public.
Perfect for the developer that works on commercial apps or APIs.
Project are private by default.
š« now's approach to scalability is unique. Here's what makes it special:
We don't under-allocate or over-allocate resources.
You don't have to ever adjust any nobs, configure instances or set up processes.
We don't depend on a single specific cloud provider, but abstract them instead.
This means that we can always find the best combination of cost, performance, reliability and resistence to failure or censorship.
In real-world applications the metadata of the request is of particular importance.
The response might vary, for example, according to the capabilities of the client. If the User-Agent
is so, or the Accept
header is such. These won't be automatically present in your payloads, so you'll have to manually supply them in each function call.
The other missing feature is the response code. Instead of returning 404
when something is not found, 403
when the permissions are not met or 500
when something goes wrong, you'll end up creating a new ad-hoc codec for errors that only your own system understands.
The way most cloud providers address the problems described above is by introducing a context object that has access to information from the environment.
The problem is that this context object varies ever so slightly from provider to provider. Were this to be standarized, it would look like HTTP.
HTTP/2 has two critical features that make your requests effectively as lean as "micro functions", from a bandwidth and efficiency perspective:
We run Node.JS 5.10.1 by default. We plan to support customizing it with the engines
field.
To define a script that has to be run everytime before install
, specify a build
script in package.json
:
{
"name": "my-project",
"dependencies": {
"gulp": "3.9.1",
"serve": "3.8.3"
},
"scripts": {
"build": "gulp",
"start": "serve ."
}
}
If you want to define a specific task for now
that overrides build
, you can define a task called now-build
. If now-build
is set, build
is ignored.
If you want to have a specific task for startup, you can specify now-start
, and the regular start
task will be ignored.
In addition, the NOW
env variable is exposed to the tasks and scripts.
Absolutely! Just use a Node program to serve your files, such as serve
:
Your package.json
can look like this:
{
"name": "my-project",
"dependencies": {
"serve": "3.8.3"
},
"scripts": {
"start": "serve ."
}
}
The team that built now has experience deploying and running the largest Node.JS deployments.
Our first Node.JS version in production was 0.1.100
, and since then we've built some of the most popular and enduring open-source modules and frameworks, such as: